RE: [xml] Try this again.. xmlNewTextChild, more info



Just some more information.
1. I am using VS.NET 2003 in a C++ environment (Really doing straight C in this project).
2. I am using the following libraries:
 
   zLib-1.1.4
   LibXML2-2.6.4
   iconv-1.9.1
 
When I compile the Add Node example @ http://www.xmlsoft.org/tutorial/ape.html, it compiles and runs correctly, in that it detects if story is the root, the XML is good, etc.  But again it does not add the node.  Or at least it does not get saved that way.
 
Has anyone else run into this problem with xmlNewTextChild??  Any advice would be very appreciated..
 
Thanks!
Ron
 
PS Sorry for the unreadable email.  Yahoo email and this mailing list don't seem to like each other. 


From: Ron Ohmer
Sent: Mon 1/19/2004 17:45
To: xml gnome org
Subject: [xml] Try this again..

Ok, here is my problem.  I have a function to insert a Child into a tree.
 
The guts of the function are as follows:
 
 

while(KeyCount<TotalKeys)

{

   if((!xmlStrcmp(cur->name,(const xmlChar *)Keys[KeyCount].Name)))

   {

       KeyCount++;

       cur=cur->xmlChildrenNode;

    }

    if(cur->next==NULL)

    {

       cur=xmlNewTextChild(cur,NULL,(xmlChar *)Keys[KeyCount].Name,NULL);

       int res;

       res=xmlSaveFile(CONFIG_FILE,doc);

       KeyCount++;

    } else

    {

        cur=cur->next;

    }

}

 

Keys is an array of char[128].

xmlDocPtr doc;

and

xmlNodePtr cur;

 

Basically the file is written exactly as it was, and the xmlNewTextChild returns NULL.

What would the proper way to insert either of the following:

<NODE NAME>VALUE</NODE NAME>

or

<NODE NAME></NODE NAME>

 

Thanks!

Ron



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