User Guide
XML.xmlDecl 479
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 declaration (stored in the XML.docTypeDecl property), followed by the text
representation of all XML nodes in the object. The XML declaration is not output if the
XML.xmlDecl property is undefined. The DOCTYPE declaration is not output if the
XML.docTypeDecl property is undefined.
Example
The following example of the XML.toString() method sends <h1>test</h1> to the log file:
var node:XML = new XML("<h1>test</h1>");
trace(node.toString());
See also
XML.docTypeDecl, XML.xmlDecl
XML.xmlDecl
Availability
Flash Player 5.
Usage
my_xml.xmlDecl:String
Description
Property; a string that 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 using a string representation of the XML declaration, not an
XML node 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.
Example
The following example creates a text field called my_txt that has the same dimensions as the
Stage. The text field displays properties of the XML packet that loads into the SWF file. The doc
type declaration displays in
my_txt. Add the following ActionScript to your FLA or AS file:
var my_fmt:TextFormat = new TextFormat();
my_fmt.font = "_typewriter";
my_fmt.size = 12;
my_fmt.leftMargin = 10;
this.createTextField("my_txt", this.getNextHighestDepth(), 0, 0, Stage.width,
Stage.height);
my_txt.border = true;
my_txt.multiline = true;
my_txt.wordWrap = true;
my_txt.setNewTextFormat(my_fmt);