Table of Contents

XML.docTypeDecl Property Flash 5

the document's DOCTYPE tag read/write
xmlDoc.docTypeDecl

Description

The docTypeDecl string property specifies the DOCTYPE tag of xmlDoc, if any exists. Otherwise, docTypeDecl is undefined. The specified xmlDoc must be the top-level node in an XML object hierarchy (i.e., an instance of the XML class, not the XMLnode class).

An XML document's DOCTYPE specifies the name and location of the document type declaration (DTD) used to validate the document. ActionScript does not perform validation of XML documents; it merely parses them. We use the DOCTYPE tag to build XML documents that may be validated externally or to identify the type of a loaded XML document.

Example

var myXML = new XML('<?xml version="1.0"?><!DOCTYPE foo SYSTEM "bar.dtd">'
                    + '<P>a short document</P>');
   
trace(myXML.docTypeDecl);  // Displays: "<!DOCTYPE foo SYSTEM "bar.dtd">"
   
// Set a new DOCTYPE
myXML.docTypeDecl = '<!DOCTYPE baz SYSTEM "bam.dtd">';

See Also

XML.xmlDecl


Table of Contents