7

Short question: any comments on comparison of pugixml and tinyxml please?

Details I need to use an XML parser/writer. My software is written in C++.

It seems to me TinyXML and pugixml are both good options (RapidXML is good as well but its interface does not seem to be as easy as the above two as I have to manage data allocations myself).

Do people have any comments on the comparison between the two? I am working on an embedded platform so memory handling is important to me, and I need to be able to both parse and write XML data.

Speed is not that important but memory usage and easier interface are.

Thanks. PS The XML files I am dealing with are fairly small (max size=1200bytes; max elements=6 or 7; XML files are fairly simple).

sw_eng
  • 129
  • 1
  • 2
  • 7
  • If it's any help I use TinyXML frequently, as do other professionals. I haven't used pugixml though! – ButchDean Jan 13 '12 at 21:07
  • 1
    Have used both and like pugixml more. Its simple, fast and has XPath support. But maybe this answer helps [link](http://stackoverflow.com/a/1448859/639650). If you stick with tinyxml, you might wan't to check out the c++ wrapper [link](http://code.google.com/p/ticpp/). – P3trus Jan 14 '12 at 23:55
  • Thanks to both of you for your replies. @P3trus - Do you have any comments on 'memory usage' of pugixml and tinyxml - for both reading and writing? The files I am going to parse/write fairly small files and I am wondering which one would be more efficient. – sw_eng Jan 16 '12 at 17:01
  • 1
    have a look here [link](http://pugixml.org/benchmark/) – P3trus Jan 17 '12 at 01:50
  • I used and tested both pugixml and TinyXML. I was impressed by pugixml's speed and low memory consumption. Also pugixml is much easier to use. The benchmarks tell the brutal truth http://pugixml.org/benchmark.html TinyXML is more than 38 times slower and takes 28 times more memory for the same XML file than pugixml. I could not believe it at first but my own test also confirmed it. I use pugixml in commercial applications to parse huge files. pugixml is a splendid parser.. – sg7 Jun 09 '16 at 01:18

3 Answers3

3

I used tinyxml, QtXml, boost property tree, and, as I remember, pugixml is fastest DOM xml-parser.

As for embedded, I used pugixml with about 9Mb xml-files - and all works fine and fast. But I don't know about your memory limitation - just write simple example and check.

Aleksey Bakin
  • 1,506
  • 13
  • 27
1

You might look at Expat. I have used it for about 8 years in a commercial product without any trouble. It is open-source with a non-viral license.

Graham Asher
  • 1,648
  • 1
  • 24
  • 34
  • I started off with Expat but expat does not have XML writing capabilities so I needed to move on to some other library that provides both parsing and XML creation capabilities. – sw_eng Jun 11 '12 at 12:30
  • There is "scew" for writing which uses expat. – Adder Jan 06 '13 at 11:16
1

I have used TinyXML 6 months ago, I think it is excellent...

kaitian521
  • 548
  • 2
  • 10
  • 25