Name
XML.toString( ) Method — the source code of the XML node, as a string
Availability
Flash 5
Synopsis
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. 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.
It’s not normally 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: 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:
The Definitive Guide</TITLE><AUTHOR SALUTATION="Mr">Colin
Moock </AUTHOR> <PUBLISHER>O'reilly & Associates, Inc
</PUBLISHER> </BOOK>See Also
Object.toString( ),
XML
.nodeValue
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access