Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What library to use to *write* XML file in a C++ program?

Tags:

c++

xml

What library to use to write XML file in a C++ program?

I've found two classes posted in CodeProject

  • http://www.codeproject.com/KB/stl/simple_xmlwriter.aspx
  • http://www.codeproject.com/KB/XML/XML_writer.aspx

but want to check if there is more standard option than these. I'm only concerned with writing, and not parsing XML.

like image 818
qazwsx Avatar asked Dec 29 '11 21:12

qazwsx


2 Answers

I tried different libraries and finally decided for TinyXml. It's compact, fast, free (zlib license) and very easy to use.

like image 149
Eddie Paz Avatar answered Oct 04 '22 14:10

Eddie Paz


Question: Are you ever going to update an XML file? Because while that sounds like it's just more writing, with XML it still requires a parser.

While xerces is large and bloated, it is fully standards compliant and it is DOM based. Should you ever have to cross platform or change language, there will always be a DOM based library for whatever language/platform you might move to so knowing how DOM based parsing/writing works is a benefit. If you are going to use XML, you may as well use it correctly.

Avoiding XML altogether is of course the best option. But short of that, I'd go with xerces.

like image 35
jmucchiello Avatar answered Oct 04 '22 12:10

jmucchiello