[EMAIL PROTECTED] wrote on 11/17/2004 11:44:42 AM:
> > So, my new question is, what would be involved in dynamically
> > switching the ContentHandler attached to a SAX2 parser, so that
> > some portions of a document could be parsed into a DOM document,
> > and others handled by a custom implementation of ContentHandler.
> > Essentially I want to switch to a DOM builder when I encounter a
> > <Header> element, then switch back to my own ContentHandler
> > implementation once the Header element has been parsed.
>
> You should do this yourself within your own ContentHandler/LexicalHandler
> derivative, rather assume the parser can support switching its handlers
> while parsing.
While this may or may not currently work with Xerces-C, the ability to switch content handlers during a parse is guaranteed by SAX [1] which says: "Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately". You should be able to rely on this behaviour.
[1] http://www.saxproject.org/apidoc/org/xml/sax/XMLReader.html#setContentHandler(org.xml.sax.ContentHandler)
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [EMAIL PROTECTED]
E-mail: [EMAIL PROTECTED]
- Accessing file position information during a SAX pars... Pete Hodgson
- Dynamically switching to/from a DOM ContentHandl... Pete Hodgson
- Re: Dynamically switching to/from a DOM Cont... david_n_bertoni
- Re: Dynamically switching to/from a DOM ... Michael Glavassevich
- Re: Dynamically switching to/from a DOM ... Pete Hodgson
- Re: Dynamically switching to/from a ... Alberto Massari
- RE: Accessing file position information during a... Erik Rydgren
- Re: Accessing file position information duri... Pete Hodgson
- Re: Accessing file position information duri... Pete Hodgson
- Re: Accessing file position information ... David Cargill
- Re: Accessing file position informat... Pete Hodgson