Hello,
I'm using
java 1.4.2 with JDom and I was wondering is there a way to strip out the middle of an xml document using XPath?
For example, if my xml file was as so:
<root>
<title>My Title</title>
<body>
<top>TOP</top>
<middle>MIDDLE</middle>
<bottom>BOTTOM</bottom>
</body>
</root>
I would like to be able to use "/root/body" to extract the body segment in it's entirety as a
string. I'm basically reading an xml document and saving a copy with some headings and such removed.
I was looking at selectNodes method, but passing an XPath expression into this returns the node ('Element' object) and the only thing I see that I can do from there is to iterate recursively through all the children. If this is the case however, it would be easier for me to read the file in and manually scan through it until I find the required node and copy until the closing tag of that node.
Any help is much appreciated,
Thanks