[xml] search a node in a tree



A buffer contains thoses datas :
<message version="1" action="C" type="request">
  <zone>encore.fr</zone>
.........
</message>


// I build a tree.
    doc = xmlParseMemory(buffer, strlen(buffer)) ; printf("tester si erreur
arbre provoque une erreur\n") ;

// Theses lines are ok
    message = xmlDocGetRootElement(doc) ;
    pszAction=xmlGetProp(message, "action") ;
    pszType=xmlGetProp(message, "type") ;

// I  need to get the content of the node "zone". The content is "encore.fr"
// To search the node , i try to use followings instructions :

    cur=xmlStringGetNodeList(doc, (const xmlChar *) "zone") ;
    printf("contenu de zone =%s\n", xmlNodeGetContent(cur)) ;

I don't get the right answear !

Can You help me , please ?

Thanks a lot.




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