User Guide

1338 ActionScript classes
toString (XMLNode.toString method)
public toString() : String
Evaluates the specified XML object, constructs a textual representation of the XML structure,
including the node, children, and attributes, and returns the result as a string.
For top-level XML objects (those created with the constructor), the
XML.toString() method
outputs the document's XML declaration (stored in the
XML.xmlDecl property), followed by
the document's
DOCTYPE declaration (stored in the XML.docTypeDecl property), followed by
the text representation of all XML nodes in the object. The XML declaration is not output if
the
XML.xmlDecl property is undefined. The DOCTYPE declaration is not output if the
XML.docTypeDecl property is undefined.
Availability: ActionScript 1.0; Flash Player 5
Returns
String - String.
Example
The following code uses the
toString() method to convert an XMLNode object to a String,
and then uses the
toUpperCase() method of the String class:
var xString = "<first>Mary</first>"
+ "<last>Ng</last>"
var my_xml:XML = new XML(xString);
var my_node:XMLNode = my_xml.childNodes[1];
trace(my_node.toString().toUpperCase());
// output: <LAST>NG</LAST>
See also
docTypeDecl (XML.docTypeDecl property), xmlDecl (XML.xmlDecl property)
XMLNode constructor
public XMLNode(type:Number, value:String)
The XMLNode constructor lets you instantiate an XML node based on a string specifying its
contents and on a number representing its node type.
Availability: ActionScript 1.0; Flash Player 8