Take a look at the class SAXPrintHandlers. It does just that. It writes nodes to a XMLFormatter from SAX interface calls. I think the easiest way for you to go is to inherit the class SAXPrintHandlers into you own class and override those methods you need (startElement, endElement and so on). Do the tag filtering in your class and just pass accepted tags to the baseclass to be written to file or whatever. For the parsing functionality take a look at the SAXPrint example (it uses SAXPrintHandlers but without tagfilters. It writes the whole document). Regards Erik Rydgren Mandarinen systems AB Sweden -----Original Message----- From: jiang lei [mailto:[EMAIL PROTECTED]] Sent: den 29 januari 2003 08:18 To: Xerces mailing list Subject: how to extract xml fragments while parsing with SAX Hi all, I am a newbie to Xerces parser and xml. What I'm trying to do is to get small pieces of DOM output while parsing with SAX. In a simple word, I want to parse a big xml document, build repeated fragments into dom documents. Thoes fragments can be identified with certain tags. The SAX parser shall be parsing a stream so I don't have access to the whole raw document. In fact, neither do I have the whole fragment in my buffer. So I have to generate the DOM document on the fly. Microsoft provided a way of doing this. Their DOM writer implemented a ContentHandler interface. So simply pass the events along to the writer's callback functions, and everthing is done. the article on http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk30/ht m/isaxxmlfilter_interface.asp shows the code. Is there any way to do that with Xerces? Thanks in advance. Best Regards Lei --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
