XML.toString( ) Method | Flash 5 |
the source code of the XML node, as a string |
A string representing the source code of the XML object hierarchy starting at theNode.
The toString( ) method converts an XML node object or an XML document object to its analogous XML source code (theNode can be an XML or XMLnode instance). If theNode is a top-level XML document object, any DOCTYPE and XML declaration tags are included in the string. If the document's ignoreWhite property is false, whitespace is preserved and the document source code appears as it did when it was parsed.
Note that the predefined entities <, >, &, ", and ' are not converted to literal characters by toString( ). To obtain the text value of a node with entities converted to literal characters, use nodeValue. For details, see parseXML( ).
Normally, it's not necessary to invoke toString( ) explicitly; toString( ) is automatically invoked any time theNode is used in a string context.
var myDoc = new XML('<?xml version="1.0"?><!DOCTYPE foo SYSTEM "bar.dtd"><BOOK> <TITLE>ActionScript for Flash MX: The Definitive Guide</TITLE>' + '<AUTHOR SALUTATION="Mr.">Colin Moock </AUTHOR> ' + '<PUBLISHER>O\'Reilly & Associates, Inc</PUBLISHER> </BOOK>'); trace(myDoc.toString()); // Displays: <?xml version="1.0"?><!DOCTYPE foo SYSTEM "bar.dtd"> <BOOK> <TITLE>ActionScript for Flash MX: The Definitive Guide</TITLE><AUTHOR SALUTATION="Mr.">Colin Moock </AUTHOR> <PUBLISHER>O'Reilly & Associates, Inc </PUBLISHER> </BOOK>
Object.toString( ), XML.nodeValue