writing Nodes

Lev Lvovsky <[email protected]> Tue, 24 Jul 2007 16:24:12 -0700
Newsgroups gmane.text.xml.xerces-p.devel
Message-ID <[email protected]>
Hello,

Upon parsing an XML file with the Xerces DOM parser, there may be  
times when I want to recreate and eventually print the XML of a  
particular DOMNode, as well as it's parent entities.  Other than  
piecing together the XML string as I traverse the structure, is there  
any Xerces function which would allow me to print out only the  
DOMElements/Nodes leading to a particular node from the root of the  
document?

As an example, assuming this is my XML:

<fruit>
   <description>
     <name>banana</name>>
     <color>yellow</color>
   </description>
   <description>
     <name>strawberry</name>
     <color>red</color>
   </description>
</fruit>

If for instance, I wanted to print out all of the XML related to the  
banana, and end up with a result like:

<fruit>
   <description>
     <name>banana</name>>
     <color>yellow</color>
   </description>
</fruit>

Are there any existing functions which can do this, or do I need to  
piece it together on my own?

thanks!
-lev