• Advertisement
Sign in to follow this  

Extracting text data from XML string using tinyxml

This topic is 4351 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hai Associates, I have been working on how to retrieve the text data from XML form using tinyxml parser since 2 days.From the following XML string i have to retrieve the data. <rx-event> <topic>Mgmt</topic> <subtopic>645268923afce</subtopic> <context>PubSubComm-3</context> <params> <rx-status>ok</rx-status> <column1>Hello</column1> <column2>412</column2> <column3>Welcome to</column3> <column4>India</column4> </params> </rx-event> I should have to get the each field(i.e Mgmt,Hello,412 etc)in to seperate variables.So kidly give me some suggestions to write the APIs to extract thedata. I am using tinyxml_2_3_3. Some body has given the solution to print all contents of XML string. Thank you very much. But my reqquirement is i have to copy some selected values in to the buffer which should be retuned to the calling function. Please give some solution to it . [Edited by - medhassu on May 23, 2006 6:16:23 AM]

Share this post


Link to post
Share on other sites
Advertisement
Something like this



void Load()
{
TiXmlDocument Doc;
Doc.Parse(your_string);

RecurseTree(&Doc);
}

void RecurseTree(TiXmlNode *pNode)
{
printf("%s\n", pNode->Value());
TiXmlNode *Child = pNode->FirstChild();
for(; Child; Child = pNode->IterateChildren(Child))
RecurseTree(Child);
}


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement