[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: dumb question:

Subject: Re: dumb question:
From: Warren Hedley <w.hedley@xxxxxxxxxxxxxx>
Date: Tue, 04 Apr 2000 12:15:10 +1200
xalan treewalker
"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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.