Re: [xml] Parse xml string with libxml



You need to use xpath to get the nodes, there are xpath examples on the libxml site. And then use  xmlXPathCastNodeToString to get the value.

On 06/10/2006, at 6:15 AM, Devang Joshi wrote:

Hi

 

I am new to libxml. Trying to parse following char* data using libxml. I want to extract following pairs of data MORE_FLAG=1, MESS_LENG=0, so on

<TestMessage><Message name="UI"><Field name="MORE_FLAG">1</Field><Field name="MESS_LENG">0</Field<Field name="RESP_LENG">0</Field></Message></TestMessage>

 

I did following, how to proceed:

 

xmlDocPtr doc;

xmlNode *root_element = NULL;

           

doc = xmlReadMemory(responseString, len, "noname.xml", NULL, 0);

/*Get the root element node */

root_element = xmlDocGetRootElement(doc);

 

Thanks,

Devang

 

_______________________________________________
xml mailing list, project page  http://xmlsoft.org/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]