Benoît Thiébault
2012-07-11 08:29:13 UTC
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?
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?