"Re: [xml] assigning attribute value without using"



Hi,

on 3/29/2004 1:05 PM Daniel Veillard wrote:

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.

Puuuh, good to hear, I already thought that I have to go "w3c 
not-conform" here.


Thanks,

Kasimier




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