tags:

views:

152

answers:

2

Hello,

I'm trying to parse XML data stored in a variable, not a file. The reason for this is that program x replies to program y in XML, so it would seem to be best to directly parse the XML from the variable.

So far I have tried to do this in TinyXML, but I don't see an interface to load from a variable.

It's basically the opposite of http://stackoverflow.com/questions/110393/tinyxml-save-document-to-char-or-string, instead of saving to char, I want to load from char(or string)

For example instead of the following:

TiXmlDocument doc( "demo.xml" );
doc.LoadFile();

something like

doc.LoadVar(char*) 

I also checked out RapidXML, but I also can't seem to find documentation to load from a variable.

Thanks

+1  A: 

You can use TiXmlDocument::Parse. See tinyxml documentation for more details.

Vlad
A: 

If you already have the document in a string why not simply call the TiXmlDocument::Parse method and be done?

dirkgently
Sure why not =p
Stanislav Palatnik