Entry
How do I use the method setLocalName?
How do I use the method setLocalName?
Apr 12th, 2005 01:55
Martin Honnen,
The method setLocalName takes one argument, the new name, and changes
the local name of this XML object to the name passed in.
Here are some examples:
var god = <god>Kibo</god>;
alert(god.toXMLString()); // shows '<god>Kibo</god>'
god.setLocalName('deity');
alert(god.toXMLString()); // shows '<deity>Kibo</deity>'
var xhtmlSnippet = <b xmlns="http://www.w3.org/1999/xhtml">Kibology
for all.</b>;
xhtmlSnippet.setLocalName('strong');
alert(xhtmlSnippet.toXMLString());
/* shows
'<strong xmlns="http://www.w3.org/1999/xhtml">Kibology for all.</strong>'
*/