Re: [xml] Need example / help for using SAX parsing on IO stream (socket)



On Wed, Jul 13, 2005 at 12:39:14PM -0400, Chris Hesterman wrote:
Daniel...

Thanks for your quick response. I had looked at the section of code that
you recommend, and will use that going forward. I am a little confused
as to why the method xmlCreateIOParserCtxt() isn't more appropriate than
xmlCreatePushParserCtxt() when dealing with a socket connection...

Is it mainly the issue of an xml message spanning across multiple reads?

  Yes unless you can put the logic splitting the document in the
stream directly in the I/O handlers, in which case, sure
xmlCreateIOParserCtxt() will work. I didn't checked but try to
make sure you build a SAX2 parser context, not just a SAX1, as SAX2
performs better and handle namespaces directly at the parser level
instead of delegating them to the user's callbacks. See debugSAX2HandlerStruct
xmllint.c around line 1581.
  In general too if you have document with DTDs and entities libxml2
SAX support won't be friendly, but I guess it's not the case.

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]