Search code examples
c++tinyxml

load XML from variable, not File


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 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


Solution

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