Re: [xml] search a node in a tree



On Wed, 2002-10-16 at 10:13, laurent nameshield net wrote:

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)) ;


Have you looked at the tutorial example which shows you how to walk
through your tree?

http://www.xmlsoft.org/tutorial/apb.html

Cheers,
John
-- 
John Fleck
jfleck inkstain net (h) jfleck abqjournal com (w)
http://www.inkstain.net http://www.abqjournal.com

"Sometimes, a diner is all about the mac and cheese." 
  - Zippy the Pinhead




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