Re: [Boost-users] is there any lib used to parse XML file in boost?

From: Tomas Puverle
... or you can use libxml (http://xmlsoft.org), which is also portable. I used it on Windows and Linux. It is a C library.
There are further advantages to using libxml. The programming model of expat is based on the SAX2 interface. Libxml has both the SAX2 and a pull-parser interface, which is generally easier to use from an application point of view. Libxml2 is generaly faster than expat. It also has better support for all the different XML features such as entities etc. I also believe it's more actively maintained and developed.
I may just be showing my ignorance here, but how do people feel about Xerces? Especially given that it's written in C++. (Note: I'm trying to install Xerces now on Solaris, and it isn't easy.) Ob the original question: Why not just use Boost serialization? - James Jones Administrative Data Mgmt. (v)732-510-1806 375 Raritan Center Pkwy, Suite A (f)732-510-1855 Edison, NJ 08837 Visit us on the web at http://www.firstinvestors.com/

I may just be showing my ignorance here, but how do people feel about Xerces? Especially given that it's written in C++.
In my experience, the problem is its performance. In many cases, I've seen it run 10+ times slower compared to libxml or expat.

james.jones@firstinvestors.com wrote
<snip>
I may just be showing my ignorance here, but how do people feel about Xerces? Especially given that it's written in C++.
(Note: I'm trying to install Xerces now on Solaris, and it isn't easy.)
In my experiencie Xerces is too bulky. For a server environment it may be ok but for client software it would be overkill when there simpler, smaller and faster libraries out there like libxml and expat. -delfin

Hi James,
I may just be showing my ignorance here, but how do people feel about Xerces? Especially given that it's written in C++.
Here is what I know about Xerces-C++ from experience: - Out of all mentioned parsers (expat, libxml2, tinyxml) it is the only validating parser that supports both DTD and XML Schema. I think libxml2 supports only DTD and the other two do not support any validation. - Fairly complete support for advanced XML features, e.g., namespaces, entity references, CDATA, etc. - Extensive support for character encodings. - Supports DOM and SAX in one package. - C++ API. It is sometimes quite ugly, though. - Fairly portable.
(Note: I'm trying to install Xerces now on Solaris, and it isn't easy.)
I didn't find the installation any more difficult than say... boost ;-). hth, -boris -- Boris Kolpackov Code Synthesis Tools CC http://www.codesynthesis.com Open Source Cross-Platform C++ XML Data Binding

On Tue, April 18, 2006 8:59, Boris Kolpackov said:
Hi James,
writes: I may just be showing my ignorance here, but how do people feel about Xerces? Especially given that it's written in C++.
Here is what I know about Xerces-C++ from experience:
- Out of all mentioned parsers (expat, libxml2, tinyxml) it is the only validating parser that supports both DTD and XML Schema. I think libxml2 supports only DTD and the other two do not support any validation.
- Fairly complete support for advanced XML features, e.g., namespaces, entity references, CDATA, etc.
- Extensive support for character encodings.
- Supports DOM and SAX in one package.
- C++ API. It is sometimes quite ugly, though.
- Fairly portable.
(Note: I'm trying to install Xerces now on Solaris, and it isn't easy.)
I didn't find the installation any more difficult than say... boost ;-).
hth, -boris
-- Boris Kolpackov Code Synthesis Tools CC http://www.codesynthesis.com Open Source Cross-Platform C++ XML Data Binding
From my experience working with Xerces 2.6 and 2.7 I can complain about extremely bad documentation. Sometimes I had to debug though xerces source code to understand how it works. In some cases where documentation stated that the particular DOM Interface is implemented NotImplementedException was thrown. The most disturbing thing is that you can not rely on documentation and in most cases documentation even does not state if this particular interface might throw an exception which can lead to unpleasent result at runtime...
You also need to write a wrapper class around Xerces XMLCh type and static XMLString member functions, because these functions are not exception safe in terms of RAII, e.g. //pre initialization here XMLCh* xmlStr=XMLString::transcode("some string"); //some code //some exception XMLString::release(xmlStr); //never reached => memory leak All document nodes were belonging to a document and you had to explicitly transform the ownership or release them which is also more or less C style programming... I always had a feeling to program C with C++ features... My suggestion would be if you can select something else choose another library... At some of the boost pages I found a reference to XiMoL project... This project seems to be a nice alternative to Xerces C. I do not know which features do you need... With Kind Regards, Ovanes Markarian

Boris Kolpackov wrote :
Here is what I know about Xerces-C++ from experience:
- Out of all mentioned parsers (expat, libxml2, tinyxml) it is the only validating parser that supports both DTD and XML Schema. I think libxml2 supports only DTD and the other two do not support any validation.
libxml2 supports DTD, XMLSchema and RelaxNG. (This isn't the case of libxml++ though, those parts haven't been wrapped yet I think)

loufoque
Boris Kolpackov wrote :
Here is what I know about Xerces-C++ from experience:
- Out of all mentioned parsers (expat, libxml2, tinyxml) it is the only validating parser that supports both DTD and XML Schema. I think libxml2 supports only DTD and the other two do not support any validation.
libxml2 supports DTD, XMLSchema and RelaxNG.
From xmlsoft.org:
"A partial implementation of XML Schemas Part 1: Structure is being worked on but it would be far too early to make any conformance statement about it at the moment." I think it is great that they are adding support for XML Schema, but there is a big difference between "being worked on" and "supports". -boris
participants (7)
-
Boris Kolpackov
-
Boris Kolpackov
-
Delfin Rojas
-
james.jonesīŧ firstinvestors.com
-
loufoque
-
Ovanes Markarian
-
Tomas Puverle