On Mon, Apr 30, 2007 at 11:04:55AM +0200, Trappel Martin wrote:
> 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)

  Latest is 2.6.28, try with it, or at least provide a piece of code which
compiles by itself, such bugs were fixed in the past.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
[EMAIL PROTECTED]  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml

Reply via email to