3

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

Community
  • 1
  • 1
stan
  • 4,885
  • 5
  • 49
  • 72

2 Answers2

1

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

Vlad
  • 35,022
  • 6
  • 77
  • 199
0

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

dirkgently
  • 108,024
  • 16
  • 131
  • 187