At 1:43 PM -0700 10/16/03, Jeremy Furtek wrote: > > Does anyone on the list have experience using an XML parser >> with C++? If so, can you recommend a decent set of parser tools? > >I have been using the Xerces-C++ parser for an application, and it has been >more than adequate. > >http://xml.apache.org/xerces-c/index.html > >I have also used expat. > >http://www.jclark.com/xml/expat.html > >The Xerces-C++ parser seems pretty complete. You can parse documents using >either the SAX or DOM interfaces. (When using SAX, you provide callback(s) >for XML element beginning and endings. The DOM interface builds a tree in >memory of the entire document contents, which you can then "walk.") My >favorite thing about Xerces-C++ is its support of XML Schema. You can >provide the parser with an XML Schema file (which is like a DTD, only in XML >format) and the parser will notify you if the document doesn't conform. > >Expat seems to be a more minimalist implementation. It is not a "validating" >parser. It is written in C, and offers a SAX-style interface. > >If pure speed is important to you... > >(I am not saying that it should be. I only bring it up because it has been >mentioned in this group recently.) > >you might want to look at the internal character representations used by the >parsers that you consider. XML files can be encoded with 8 or 16 bit >characters. The Xerces-C++ parser interface uses 16 bit characters, >regardless of the encoding of the document. If I remember correctly, expat >uses 8 bit characters. If all of your XML files are encoded in 8 bits, you >might be able to realize a small performance gain by using a parser that >takes advantage of this fact. > >Of course, if speed is that important, you could probably select a better >format than XML.
At 9:30 AM -0500 10/15/03, Riley Rainey wrote: >Hey Bruce, > >Our company uses Xerces-C quite a lot. It does provide for different styles >of programmatic access and my experience so far has been positive. > >At a previous company I worked with Microsoft's XML Parser and DOM (DOM == >Document Object Model, for those who didn't know); DOM access worked well in >most cases, but MSFT requires that you embrace some form of COM programming >style in your C++ code (e.g. ATL). > >Riley At 10:25 AM -0400 10/15/03, York, Brent W. CIV NAVAIR 4.3.2.3 wrote: >Bruce, > >We've used MSXML and Expat. We use a wrapper library called "SAXinCPP," which is open >source thing you can find on the Internet. I think the guy who wrote it changed the >name to something catchier, though, since we started using it. If you want, I can >have our XML expert send what we have to you... > >_Brent At 9:38 AM -0500 10/15/03, Jon S Berndt wrote: >Hi, Bruce: > >Check out the FlightGear (www.flightgear.org) project for one example ("easyXML") and >perhaps ask a question on their developer list (or I can do that). For JSBSim, I >wrote a very limited parser in C++ that I use, but I've been wanting to evolve into >using a more capable parser - a *real* one. Of course, for my project I need to >consider open source projects. There are two (as I recall): TinyXML, and eXpat - both >on the SourceForge web site: > >http://tinyxml.sf.net >http://expat.sf.net (see the C++ wrappers links) > >Good luck, > >Jon Thanks, Jon, Brent, Riley & Jeremy. I'd been eyeing Xerces-C++ but was not aware of the 16-bit (UNICODE, I guess) character representation. I might stick with it anyway since it seems like the right choice (open source, well-supported, and popular). I've been using Xerces-J for a Java XML application, and am well satisfied with it; I wanted to see if maybe I was missing a better solution. I'll look into the other suggestions (expat, easyXML, tinyXML, and SAXinCPP) but suspect MSXML is a Windows-only solution? Thanks again for the rapid response! --Bruce