Hello
I need to update the value of a particular key. Using the libxml tutorial
Appendix E as a starting point I changed parsestory as below to update the
contents of the node with key=keyword.
Will this code leak memory? Do I need to free the existing contents before
overwriting? Here is code:
void parseStory (xmlDocPtr doc, xmlNodePtr cur, char *keyword) {
cur = cur->xmlChildrenNode;
while (cur != NULL) {
if ((!xmlStrcmp(cur->name, (const xmlChar *)"keyword"))){
cur = cur->children;
cur->content = xmlStrndup((const xmlChar *)"mynewvalue",
strlen("mynewvalue"));
}
cur = cur->next;
}
return;
}
Angus
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml