Wednesday, 18 September 2013

Parse a version information xml and print it using c++ libxml

Parse a version information xml and print it using c++ libxml

Here is the input I get.
<record name="Version">
<field name="major" value="03&#10;"/>
<field name="minor" value="01&#10;"/>
<field name="micro" value="00&#10;"/>
<field name="patch" value="05&#10;"/>
</record>
need to print it like "Version: 03.01.00.05"
MgmtXml::dumpXmlNode(
recordNodePtr,
str);
//with above statement, I get the xml file into "str" in same format
every-time
doc = xmlParseMemory(str.c_str(), str.length());
cur = xmlDocGetRootElement(doc);
v = xmlGetProp(cur, (const xmlChar *)"name");
printf("\n%s:\n", v); //here it prints Version:
// don't know how to print the rest, which is 03.01.00.05
Thanks!

No comments:

Post a Comment