faqts : Computers : Programming : Languages : JavaScript : XML : E4X (ECMAScript for XML) : XML objects

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

3 of 4 people (75%) answered Yes
Recently 3 of 4 people (75%) answered Yes

Entry

How do I use the method setName?
How do I use the method setName?

Apr 12th, 2005 02:32
Martin Honnen,


The method setName takes one argument, the new name, and replaces the
name of this XML object with the name passed in.
The name argument can be a string or a QName object.
Here are some examples:
  var god = <god>Kibo</god>;
  god.setName(new QName('http://example.com/2005/04/deities', 'deity'));
  alert(god.toXMLString());
  /* shows 
   '<deity xmlns="http://example.com/2005/04/deities">Kibo</deity>'
  */