Re: [xml] assigning attribute value without using



On Mon, Mar 29, 2004 at 01:04:18PM +0200, Kasimier Buchcik wrote:
Hi,

Is it sane to use "xmlAddChild((xmlNodePtr)attr, 
xmlNewDocText(attr->doc, BAD_CAST "&ent1;")" instead of 
"xmlNodeSetContent" if assigning a value to an attribute node?

The intention is to reflect the DOM Attr.value method:
"On setting, this creates a Text node with the unparsed contents of the 
string, i.e. any characters that an XML processor would recognize as 
markup are instead treated as literal text."

I tried serialization and it worked fine.

Does anyone see any side effects?

  That should work, assuming attr->children == NULL, otherwise unlink the
children node list and free it.

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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