[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]