Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] Retrieving the path from root of an Element

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Benoît Thiébault <thiebault AT artenum.com>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: [XOM-interest] Retrieving the path from root of an Element
  • Date: Wed, 11 Jul 2012 10:29:13 +0200

Hi everyone,

I am new to XOM and so far, I managed to use it successfully.
There is however something that I would like to do and can't find a way to do it.

I want to retrieve, as a String, the path to root of a given Element.
For instance, consider the following XML file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<bookstore>
<book>
<title lang="eng">Harry Potter</title>
<price>29.99</price>
</book>
</bookstore>

When reading the Element associated with the <title> tag, I would like to build the String: /bookstore/book/title.
I thought the following line would work :
element.getValue();

But this only returns a bunch of spaces (it seems to be the indentation spaces of the XML file)...
What did I do wrong?





Archive powered by MHonArc 2.6.24.

Top of Page