You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Vl...@bmo.com on 2002/02/26 19:25:01 UTC

SAX to DOM

Hi all,

Is there a way in Xerces to build DOM from SAX? 
(org.xml.sax.ContentHandler)

- vlad

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


RE: SAX to DOM

Posted by Paul Brown <pr...@fivesight.com>.
> -----Original Message-----
> From: Vlad.Epshtein@bmo.com [mailto:Vlad.Epshtein@bmo.com]
> Is there a way in Xerces to build DOM from SAX?
> (org.xml.sax.ContentHandler)

Grab Xalan (or another TrAX compliant XSLT processor like Saxon) and do
something like:

SAXSource ss = new SAXSource(xr, is);
DOMResult dr = new DOMResult();
TransformerFactory.newInstance().newTransformer().transform(ss,dr);
Document doc = (Document) dr.getNode();

This way, you're not stuck with a non-standard SAX-to-DOM implementation.
(Hopefully, the XSLT processor handles namespaces, etc. properly.)

	-- Paul


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org