S
Scott Simpson
I can build portions of DOM trees with jdom and xpathapi and using "new
Element()" and "appendChild()" or "addContent()". Which function do I
use to get a whole portion of a DOM tree though? For example, suppose I have
<foo>
<bar name="dopey">
<snafu>
Text
</snafu>
</bar>
<bar name="sleepy">
<snafu>
More text
</snafu>
</bar>
</foo>
I can use an XPath query like
"/foo/bar[@name="dopey"]/ancestor-or-self::*" but that will give me back
a *list* of all the nodes it found. I want a pointer to the top <bar>
node and I want the rest of the stuff to be in a hierarchy below that
just like it is in the XML file. Is there a way to retrieve a hierarchy?
Thank you.
Element()" and "appendChild()" or "addContent()". Which function do I
use to get a whole portion of a DOM tree though? For example, suppose I have
<foo>
<bar name="dopey">
<snafu>
Text
</snafu>
</bar>
<bar name="sleepy">
<snafu>
More text
</snafu>
</bar>
</foo>
I can use an XPath query like
"/foo/bar[@name="dopey"]/ancestor-or-self::*" but that will give me back
a *list* of all the nodes it found. I want a pointer to the top <bar>
node and I want the rest of the stuff to be in a hierarchy below that
just like it is in the XML file. Is there a way to retrieve a hierarchy?
Thank you.