dcsimg
Retrieving a Node from XML document
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Rajneesh_Garg
Posted On:   Monday, January 28, 2002 04:49 AM

Hi,

I need to retrieve a complete Node from the given XML document (either as another XML document or a String, so that I can generate XML file from it). I know the structure of the XML document.


Is there any way to do so?



Regards,

Rajneesh Garg

RGarg@Indiatimes.com

Re: Retrieving a Node from XML document

Posted By:   Naveed_Azhar  
Posted On:   Monday, January 28, 2002 05:11 AM

easy solution!


use org.apache.xml.serialize.XMLSerializer ( in xerces.jar ). This code may help you

// element is the element node that needs to be serialized.
// writer is an object of subclass of Writer ( too many choices !! )
// format is instance of org.apache.xml.serialize.OutputFormat
XMLSerializer serial = new XMLSerializer(writer, format);

serial.asDOMSerializer();

serial.serialize(element);



naveed@hotmail.com
About | Sitemap | Contact