(I plan to use my VS2005)
Assume that there is not .NET installed on my computer. For the app will run on some computers which there is no .NET environment.
I just want to find a good lib on parsing XML in C++. I googled and found LibXML++, XmlLite, and Xerces-C++ XML Parser(Top result from google page). How do I decide to choose one from them?
I need parse some complex Xml files easily and export the contents to MS Excel file (.csv). All of these xml file based on on开发者_JS百科ly one XSD file. The XSD file may change in the coming days. But I don't want to parse the XSD file.
Thanks for any comments and suggestions.
I've used Xerces in a couple of c++ projects and I've always been happy with it. It provides support for both sax and dom parsing, can optionally validate your xml document using an xsd and you can use it's "sister" library xalan to perform xslt transformations. On top of that it's open source and cross platform. If you open the solution in Visual Studio, there are a bunch of examples which let you find your way pretty quickly.
I'm not familiar with the other mentioned libraries, just giving my two cents on Xerces.
If you're open to commercial options, there are several that might help you get what you need faster: LiquidXML, HydraExpress (*I work for the company that produces HydraExpress), CodaLogic
Since I couldn't see it in any of the items Georg linked to (they largely seem focused on TinyXML, RapidXML, pugixml and Xerces) I'd add XMLLite is one I used with some success. It's very performance oriented and stream based. It's not necessarily the easiest to use however, but for pure performance considerations it's worth a look.
You need to choose whether you want to process your xml decuments fast , efficiently and with no restrictions is size. In which case you want a SAX parser such as EXPAT. This will however be a pain to program if you want to do more than access the elements and attributes in sequence.
If you want to randomly access parts of the XML or store the results in your spreadsheet in a differnet sequnce from which they appear in the XML doc you probably need a DOM parser. Xerces is the best open source one -- but MS also provide an excellent XML parser (forget what its called!).
精彩评论