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




Has this become a FAQ, or what?

This is at least the fourth or fifth time this has been asked in the
last month or so.

Daniel's answer is always that NO there is no XML conformant way to
separate messages in a stream. There is no way that is XML conformant to
ignore extraneous bytes between messages.

If you want to stream multiple messages to it you must define your own
protocol (and write code to implement it) that identifies message
beginning and end points.

Fred

-----Original Message-----
From: xml-bounces gnome org [mailto:xml-bounces gnome org] On Behalf
Of
Chris Hesterman
Sent: Friday, July 15, 2005 4:23 PM
To: xml gnome org
Subject: [xml] Is there a way using SAX2 IO Parser to ignore chars
before
/after a "document"?

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"?

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()?

Any ideas would be appreciated.

Chris Hesterman

_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml

This email and any files transmitted with it are confidential and intended solely for the use of the 
individual or entity to which they are addressed. If you have received this email in error, please notify the 
system manager. Please note that any views or opinions presented in this email are solely those of the author 
and do not necessarily represent those of the company. Finally, the recipient should check this email and any 
attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus 
transmitted by this email.



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