[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: dumb question:
"Narahari, Sateesh" wrote: > > using the DOM model, you can easily make an XML document. However, saving it > to a file will be a big pain , since AFAIK, only MSXML parser supports Save > method. Actually you can use something like xalan's TreeWalker in combination with their FormatterToXML to output XML from DOM. Here's some sample code, which is just the relevant bits that I've ripped out of one of my projects - untested as is! import org.apache.xalan.xpath.xml.FormatterToXML; import org.apache.xalan.xpath.xml.TreeWalker; FormatterToXML xmlFormatter = null; TreeWalker treeWalker = null; xmlFormatter = new FormatterToXML(System.out); xmlFormatter.indent = 2; treeWalker = new TreeWalker(xmlFormatter); Document document; // construct the document treeWalker.traverse(document); xmlFormatter.flush(); Hope this helps. -- Warren Hedley Department of Engineering Science Auckland University New Zealand XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|