A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Head First Android
this week in the
XML and Related Technologies
DOM document to Sax parser
Joined: Jan 27, 2005
May 22, 2007 11:30:00
The client api provides us with a method that returns DOM document. The method processes the XML and the XML need not adhere to any schema.
In order to display the content of this document, I want to use SAX parser. Is there a way, I pass this document to SAX parser ?
Or, is there any other way to do this.
Thanks in advance,
Joined: Oct 14, 2005
May 22, 2007 13:11:00
I assume you have written a
that you would like to plug into a
? Then do this:
DOMSource ds = new DOMSource(yourDOMDocument); SAXResult sr = new SAXResult(yourContentHandler); TransformerFactory tf = transformerFactory.newInstance(); Transformer tx = tf.newTransformer(); tx.transform(ds, sr);
If I am not mistaken this should call the methods in your
I agree. Here's the link:
subject: DOM document to Sax parser
Difference between SAX and DOM parsers
SAX -- DOM?
How can we store serialized object
tranverse back an xml using SAX Parsers
parsing XML document against DTD!!!
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015