The Joel on Software Discussion Group (CLOSED)

A place to discuss Joel on Software. Now closed.

This community works best when people use their real names. Please register for a free account.

Other Groups:
Joel on Software
Business of Software
Design of Software (CLOSED)
.NET Questions (CLOSED)
TechInterview.org
CityDesk
FogBugz
Fog Creek Copilot


The Old Forum


Your hosts:
Albert D. Kallal
Li-Fan Chen
Stephen Jones

SIMPLEST xml parser, C or C++

I am looking for the SIMPLEST, yet BUG-FREE implementation of NON-VALIDATING XML parser. I simply want to read and write a lengthy settings file.

I`ve seen TinyXML, and although it seems good, it seems a bit overly complex for my needs.

Any personal recommendations appreciated.
TiN
Saturday, February 23, 2008
 
 
xerces for C++.
Send private email
Saturday, February 23, 2008
 
 
TinyXML is simpler than Xerces.
.
Saturday, February 23, 2008
 
 
Xerces ain't bug-free, at least not in C++.

The last time I tried it, the C++ version barfed on documents that Xerces-Java parsed just fine.

My vote: expat.
David Jones Send private email
Saturday, February 23, 2008
 
 
CMarkup - just add Markup.cpp/.h to your project. High performance, low footprint, simple API, designed from the beginning (9 years ago) for exactly what you are describing: to deal with XML quickly without having to earn a degree in XML; it is just some text and tags after all! With xerces or expat or others you get a bunch of source files and/or a complex object model. CMarkup is one single source class encapsulating the marked up document. The download is just a zip, no hassle or sign-up. If you end up using it in a commercial project and/or want more features, the developer version is $249.
Ben Bryant Send private email
Saturday, February 23, 2008
 
 
Yes Expat is the way to go.
Jonathan
Saturday, February 23, 2008
 
 
boost::property_tree is the answer
Max Send private email
Sunday, February 24, 2008
 
 
TinyXML too difficult? Not sure how one could argue that. Anything less would not be functional enough for anything.

That being said, look up the free 'pugxml' on codeproject.com. One file with enough functionality to add/read alements and attributes. It worked ok enough for me in one small utility.
joske vermeulen
Sunday, February 24, 2008
 
 
Have a look at pugXML and the associated articles that use it at http://www.codeproject.com You'll also find other XML parsers there.
Neville Franks Send private email
Sunday, February 24, 2008
 
 
I cannot judge the possibility to switch to something different - for me replacing XML by JSON (http://www.json.org/) does most of the time a better job for settings. It's more compact, but still very powerful.

I rewrote this (http://www.json.org/JSON_checker/) small ingenious piece of software to get a self-contained full-fledget C++ parser for the format
Micha Send private email
Sunday, February 24, 2008
 
 
... full-fledged
Micha Send private email
Sunday, February 24, 2008
 
 
If you have to be cross platform libXML

http://xmlsoft.org/

I use on linux, windoze, HP AIx, Solaris

Sunday, February 24, 2008
 
 
expat
Anon
Sunday, February 24, 2008
 
 
I haven't used it but you might want to look at http://rapidxml.sourceforge.net/ this is the parse used in boost::propertytree
Tony Edgecombe Send private email
Monday, February 25, 2008
 
 
Download the simple cross platform c++ parser by Dr. Ir. Frank Vanden Berghen from the downloads section of

http://www.applied-mathematics.net/.Only two files.
Simple and  very useful.
bijumon thomas Send private email
Monday, February 25, 2008
 
 
You have to email the guy to get it? No thanks.

Monday, February 25, 2008
 
 
>> You have to email the guy to get it? No thanks. <<

Or you could read the error message for the broken link, go to the home page and navigate to the XML Parser.  But I guess reading and thinking is a bit more effort than even emailing the guy.

http://www.applied-mathematics.net/tools/xmlParser.html
Mark Mulder
Monday, February 25, 2008
 
 
Crap...  my apologies!  I actually read the XML parser page and saw what you're referring to.  I'll shut up now.
Mark Mulder
Monday, February 25, 2008
 
 
Expat. I use it in CartoType, my portable mapping library, and it has never given me any trouble in over four years.
Graham Asher Send private email
Monday, February 25, 2008
 
 
+1 to libxml2.

We used to use Xerces, and found it to be slow, buggy and every new release broke working code.  Not to mention, if you want to use xpath expressions (and you do, trust me), you also need Xalan; where certain versions of Xalan only work with certain versions of Xerces.

Short version, Xerces was a nightmare.  Ever so happy that we finally ditched it, and have had no problems at all w/libxml2.
BillAtHRST Send private email
Monday, February 25, 2008
 
 
Is there any stream orientated parser that can handle gzipped files on the fly?
Martin Send private email
Monday, February 25, 2008
 
 
Binary XML

I've never used this, but looks ok. Only reason I'm  mentioning it as I see there is a "C" version of it.

http://vtd-xml.sourceforge.net/

Most likely to complicated for a "settings" file.
Anon cause I fear the real world
Monday, February 25, 2008
 
 
You could try this one: http://www.codeproject.com/KB/XML/minimal_XML_parser.aspx - it might be too basic, though.
Alex Cohn Send private email
Tuesday, February 26, 2008
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz