I am developing a game under cocos2dx for android. I need to parse several XML files.
My first thought was to use rapidxml, but the I realized tha cocos2d-x parses the XML files from the TiledMapEditor software. So I was thinking if there is some class for parsing XMLs in cocosd2-x.
Has anyone done something like this??
If the answer is no, which parser di you recomend??
I have used RapidXml and I like it but may be for cellphones it is not so good.
I decided to use another library (because at the time I wasn’t aware there was one in cocos2d-x and didn’t bother to search) : pugixml. It works well on iOS and Android, the only problem being you can’t use any string formatter (%s for example) nor line break () because those will be interpreted somewhere in pugixml (instead, I use another convention in my XML and replace at runtime).
The other advantage is being able to write XML files. As far as I know, cocos2d-x doesn’t support it (but I might be wrong).
I decided to use another library (because at the time I wasn’t aware there was one in cocos2d-x and didn’t bother to search) : pugixml. It works well on iOS and Android,
+1 to pugixml. I’m also using it. I was using libxml2 before but it was way too much for a simple XML.
>the only problem being you can’t use any string formatter (%s for example) nor line break () because those will be interpreted somewhere in pugixml (instead, I use another convention in my XML and replace at runtime).
I think you can do that using CDATA and other stuff.