XML.toString( ) Method

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
XML.toString( ) Method Flash 5

the source code of the XML node, as a string
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>    </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>

See Also

Object.toString( ), XML.nodeValue



    ActionScript for Flash MX. The Definitive Guide
    ActionScript for Flash MX: The Definitive Guide, Second Edition
    ISBN: 059600396X
    EAN: 2147483647
    Year: 2002
    Pages: 780
    Authors: Colin Moock

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net