
XML.toString() Method
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
948
|
ActionScript Language Reference
XML.toString() Method
the source code of the XML node, as a string
Flash 5
theNode.toString()
Returns
A string representing the source code of the XML object hierarchy starting at theNode.
Description
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.
Example
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> ...