A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
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
It is sorta covered in the
JavaRanch Style Guide
subject: DOM document to Sax parser
parsing XML document against DTD!!!
Difference between SAX and DOM parsers
SAX -- DOM?
tranverse back an xml using SAX Parsers
How can we store serialized object
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013