Hello!
Normally I'm using xmlSetProp(..) to write properties, which works.
In one instance I've used xmlNewProp(..) and it seems that this function
leads to an invalid document tree ... ?
Consider this:
--- test.xml ---
<?xml version="1.0" encoding="UTF-8"?>
<ROOT/>
---
****
xmlDocPtr doc = xmlReadFile(fname, NULL, XML_PARSE_NOBLANKS);
xmlNodePtr root_element = xmlDocGetRootElement(doc);
if(XML_ELEMENT_NODE == root_element->type) {
xmlAttrPtr newAttr1 = xmlNewProp(root_element, XMLCHARCAST("attrname"),
XMLCHARCAST("attrvalue"));
xmlAttrPtr newAttr2 = xmlNewProp(root_element, XMLCHARCAST("attrname"),
XMLCHARCAST("attrvalue"));
}
xmlSaveFile(fname, doc);
****
--- test.xml ---
<?xml version="1.0" encoding="UTF-8"?>
<ROOT attrname="attrvalue" attrname="attrvalue"/>
---
Is this the intended behaviour of xmlNewProp(..)? (libxml2 2.18.0)
best regards / mit freundlichen Grüßen,
Martin Trappel
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml