[xml] switching from expat to libxml2



Hi everyone!

I want to switch from expat to libxml2 in my project. I studied the libxml2 API but I have some doubts about 
the best way to do it.

1.
Is it better to use the function xmlSAXUserParseMemory() and related, or to use xmlCreatePushParserCtxt() 
passing a sax handler, and then xmlParseChunk?

The first choice seems easier to implement and more efficient (it uses simply the sax handler struct). But 
the error information seems poor:  xmlSAXUserParseMemory() "Returns: 0 in case of success or a error number 
otherwise", not the more meaningful xml_ParserErrors.

The second choice, on the other hand, uses the struct xmlParserCtxt that keeps a lot of information I don't 
need.

2.
What's the difference between SAX2 and SAX1 interface? Can I use SAX2 in the place of the old expat calls?


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