W3C home > Mailing lists > Public > www-dom@w3.org > October to December 2000

Re: Hoo to add an attribute to a node?

From: Gareth Reakes <gareth@decisionsoft.com>
Date: Tue, 28 Nov 2000 09:39:07 +0000 (GMT)
To: mario.heiss@gerling.de
cc: www-dom@w3.org
Message-ID: <Pine.LNX.4.21.0011280936330.1061-100000@phoenix.dsl.net>
Hello,

You can not append an attribute using appendChild(). It will cause a
HIERARCHY_REQUEST_ERR. You should use setAttributeNode(). This applys only
to element nodes so you may have to static_cast first.

Gareth


> 
>         if(attributes)
>         {
>           node.appendChild(myAttr); //add attribute to the node
>         }
> 
> ....
> 
> Thanks in advance
> Mario
> 
> 
Received on Tuesday, 28 November 2000 04:39:44 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:48 GMT