Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using XML files to store data

Tags:

c++

xml

If i'm going to use a XML file to store some information, Am I going to need a XML Parser that read/write data? Can i just use string manipulation functions and why not?

like image 251
user753214 Avatar asked Jun 04 '11 03:06

user753214


1 Answers

You could conceivably use string manipulation functions, as that's what XML libraries end up using anyway. XML documents are just long strings in a special format. However, unless you know a lot about XML (and what is and isn't valid XML), using an XML parser/serializer now will save you a lot of trouble later on. There are nuances to XML (namespaces, escape sequences, etc) that will cause issues in homegrown code that doesn't know how to handle them properly. And by the time you've handled all the special cases, you'll effectively have written a half-assed XML parser anyway.

like image 114
cHao Avatar answered Sep 20 '22 09:09

cHao