开发者

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 wan开发者_开发问答t 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


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜