Name

XML.xmlDecl Property — the document’s XML declaration tag

Availability

Flash 5

Synopsis

XMLdoc.xmlDecl

Access

Read/write

Description

The xmlDecl string property represents the XML declaration tag of XMLdoc, if any exists. Otherwise, xmlDecl is undefined . XMLdoc must be the top-level node in an XML object hierarchy (that is, an instance of the XML class, not the XMLnode class.)

The XML declaration tag of an XML document is used to identify the version of XML being used in the document. We use the XML declaration tag to build well-formed XML documents that may be validated externally.

Example

// A well-formed document (but not validated against a DTD)
myXML = new XML('<?xml version="1.0"?><P>this is a short document</P>');
trace(myXML.xmlDecl);  // Displays: "<?xml version="1.0"?>"
// Set a new XML declaration
myXML.xmlDecl = '<?xml version="1.0" standalone="no"?>';

See Also

XML .docTypeDecl

Get ActionScript: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.