How do I write a DOM document as an XML file?

Pramod Hirole

Use xerces parser from apache. You should use the XMLSerializer class to serialise dom to xml file. Here is code sniplet.

// import following package
import org.apache.xml.serialize.*;

// following code serializes
// dom to xml file

OutputFormat of = 
       new OutputFormat("XML","UTF-8",true);
XMLSerializer serializer = 
                       new XMLSerializer();
You can get the xerces parser from Apache.
0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.