
ADOBE FLASH MEDIA INTERACTIVE SERVER
Server-Side ActionScript Language Reference
145
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 decla-
ration (stored in the
XML.docTypeDecl property), followed by the text representation of all XML nodes in the object.
If the
XML.xmlDecl property is undefined, the XML declaration is not output. If the XML.docTypeDecl property
is
undefined, the DOCTYPE declaration is not output.
Availability
Flash Media Server 2
Returns
A string.
Example
The following example of the
XML.toString() method sends <h1>test</h1> to the log file:
var node = new XML("<h1>test</h1>");
trace(node.toString());
XML.xmlDecl
my_xml.xmlDecl
Specifies information about a document’s XML declaration. After the XML document is parsed into an XML object,
this property is set to the text of the document’s XML declaration. This property is set by using a string representation
of the XML declaration, not an XMLNode object. If no XML declaration is encountered during a parse operation,
the property is set to
undefined.XML. The XML.toString() method outputs the contents of the XML.xmlDecl
property before any other text in the XML object. If the
XML.xmlDecl property contains the undefined type, no
XML declaration is output.
Availability
Flash Media Server 2
Example
The following example loads an XML file and outputs information about the file:
var my_xml = new XML();
my_xml.ignoreWhite = true;
my_xml.onLoad = function(success){
if (success){
trace("xmlDecl: " + my_xml.xmlDecl);
trace("contentType: " + my_xml.contentType);
trace("docTypeDecl: " + my_xml.docTypeDecl);
trace("packet: " + my_xml.toString());
}
else {
trace("Unable to load remote XML.");
}
};
my_xml.load("http://foo.com/crossdomain.xml");
See also
XML.docTypeDecl, XML.toString()
Commenti su questo manuale