Home
| Calendar
| Mail Lists
| List Archives
| Desktop SIG
| Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU |
The biggest problem I have with parsing XML in C/C++ is that there are no real standard objects to do so. You are confronted with not one but two basic problems: (1) the parser and (2) the object model. There are lots of XML parsers, i.e. systems like expat work fine, that answers problem #1. The next problem is how do you represent the data in C++? How generic does it need to be? what attribute takes will you recognize? will a <tag value='abcedf'/> be sufficient? Or does it need to be <tag>abcdef</tag>? Can it be both? Where's your data type represented, in the tag or a type attribute? XML's great strength is that it will represent anything. Its weakness is it doesn't say how. I ended up writing my own, using expat as the parser, and a sort of tree node structure to represent the OM. It ended up looking a little like libxml2. So, in my system, it works something like this: Node * n = xmlparse(xml); Node *nat = n->get("attribute") Node natChild = nat->getChild(); for(int i=0; natChild; i++) natChild = natChild->getNext(); and so on. I have yet to see anything standard and generically applicable on C++ that doesn't require a lot of work and tailoring to a specific data source format and purpose. > From: Stephen Adler<adler-wRvlPVLobi1/31tCrMuHxg at public.gmane.org> > Subject: c++ xml parser > To: "Blu unix (blu)"<discuss-mNDKBlG2WHs at public.gmane.org> > Message-ID:<4DB0B6DD.7090900-wRvlPVLobi1/31tCrMuHxg at public.gmane.org> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > Hi Blu'ers, > > I'm looking to write some code which needs to parse the contents of an > xml file in c++. A quick search brings up xerces, rapidxml, tinyxml and > a few other packages. Does anyone have a suggestions as to which one I > should learn? > > Thanks. Steve
BLU is a member of BostonUserGroups | |
We also thank MIT for the use of their facilities. |