Re: [xml] Is there a way using SAX2 IO Parser to ignore chars before / after a "document"?



On Fri, Jul 15, 2005 at 04:45:51PM -0400, Chris Hesterman wrote:
Hi.

I'm using the xmlCreateIOParserCtxt() and xmlSAXUserParseMemory()
methods to parse XML messages being received on a socket.

I have the program running, and am able to use the SAX2 callbacks to
parse complete XML messages, as long as they come in one at a time, and
without extraneous characters before or after them.

Is there a way to use the parser callbacks to "ignore" leading or
trailing characters between valid XML "documents"?

  No. libxml2 implements an XML parser, spaces are significant.

And, is there a way to handle two or more XML "documents" (i.e.
messages) within one read() (i.e. within one call to
xmlSAXUserParseMemory()?

  No libxml2 implement an XML parser and a document with 2 root is
a fatal error.

Any ideas would be appreciated.

  Reading at least the archives from last week would give you a detailed
explanation of why stacking mutiple XML document in a single stream is a 
broken design. Read the archives !

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]