You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Philippe QUERREC <pq...@cosmosbay.com> on 2000/12/13 15:06:29 UTC

How adding an attribute to a node ?

Hi all,
I wonder how adding an attribute to a node, I'm using Xerces 1.2.1 and I
don't know how to create a new attribute and attaching it to a node, I only
find the way to modify an attribute.
 
Thanks
Pils

Re: How adding an attribute to a node ?

Posted by Elena Litani <hl...@jtcsv.com>.
Hi, Philippe

Maksim is right, just note that if your application is namespace aware
you should use setAttributeNS().

You can find more about DOM at:
http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html

Also, look at sample code provided with Xerces:
http://xml.apache.org/xerces-j/samples.html

Good Luck
Elena

> Philippe QUERREC wrote:
> 
> Hi all,
> I wonder how adding an attribute to a node, I'm using Xerces 1.2.1 and
> I don't know how to create a new attribute and attaching it to a node,
> I only find the way to modify an attribute.
> 
> Thanks
> Pils

RE: How adding an attribute to a node ?

Posted by Dan Wahlin <wa...@home.com>.
I normally use the setAttribute() method since it's quick and easy.  If the
attribute is there it will get updated.  If not, it will get added to the
element.
  -----Original Message-----
  From: Philippe QUERREC [mailto:pquerrec@cosmosbay.com]
  Sent: Wednesday, December 13, 2000 7:06 AM
  To: 'xerces-j-dev@xml.apache.org'
  Subject: How adding an attribute to a node ?


  Hi all,
  I wonder how adding an attribute to a node, I'm using Xerces 1.2.1 and I
don't know how to create a new attribute and attaching it to a node, I only
find the way to modify an attribute.

  Thanks
  Pils