Introduction to XML in Flash
by senocular
Editing Text Nodes and Element Names
If you'll remember, the nodeValue (text nodes)
and nodeName (elements) properties for XML nodes
were not read-only as many of the other properties
like firstChild and nextSibling were. This means
that, like attribute values, they too can be
edited directly. Example:
- var my_xml
= new
XML("<loss>We
cannot perform well.</loss>");
- trace(my_xml);
// traces "<loss>We
cannot perform well.</loss>"
-
- my_xml.firstChild.nodeName
= "victory";
- my_xml.firstChild.firstChild.nodeValue
= "We
dominate!";
- trace(my_xml);
// traces "<victory>We
dominate!</victory>"
And much like createTextNode, setting nodeValue
will transform undesirables into character entity
references.
|