[xml] newbie question



Hi ,
can someone help a newbie like me on a silly question
? 

I've to replace the value of a node child,something
like this
<parent>
            <node1>value1</node1>
             <node2>value_to_modify</node2>

So I was thinking a naif solution could be 
point a xmlNodePtr n to the parent and
going on until I meet node2
 
while (n != NULL){
        if (!(xmlStrcmp(n,(const xmlChar *)"node2"))){
            xmlNodeSetContent(n,data);
        }
        n=n->next;
    }

But using libxml2 ver. 2.6.20,  the while ends up when
i found the text node reprensenting value1. 

Where I'm wrong ?



        
                
______________________________________________________
Click here to donate to the Hurricane Katrina relief effort.
http://store.yahoo.com/redcross-donate3/



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