
ADOBE FLASH MEDIA INTERACTIVE SERVER
Server-Side ActionScript Language Reference
123
var textNode1 = doc.createTextNode("textNode1");
var textNode2 = doc.createTextNode("textNode2");
// Place the new nodes into the XML tree.
element2.appendChild(textNode1);
element3.appendChild(textNode2);
trace(doc);
// Output (with line breaks added between tags):
// <element1>
//<element2>textNode1</element2>
//<element3>textNode2</element3>
// </element1>
See also
XML.createElement()
XML.docTypeDecl
my_xml.docTypeDecl
Specifies information about the XML document’s DOCTYPE declaration. After the XML text has been parsed into an
XML object, the
XML.docTypeDecl property of the XML object is set to the text of the XML document’s DOCTYPE
declaration (for example, <!DOCTYPE greeting SYSTEM "hello.dtd">). This property is set by using a string
representation of the
DOCTYPE declaration, not an XMLNode object.
The ActionScript XML parser is not a validating parser. The
DOCTYPE declaration is read by the parser and stored in
the
XML.docTypeDecl property, but no DTD validation is performed.
If no
DOCTYPE declaration occurs during a parse operation, the XML.docTypeDecl property is set to undefined. The
XML.toString() method outputs the contents of XML.docTypeDecl immediately after the XML declaration stored
in
XML.xmlDecl and before any other text in the XML object. If XML.docTypeDecl is undefined, there is no
DOCTYPE declaration.
Availability
Flash Media Server 2
Example
The following example uses the
XML.docTypeDecl property to set the DOCTYPE declaration for an XML object:
my_xml.docTypeDecl = "<!DOCTYPE greeting SYSTEM \"hello.dtd\">";
XML.firstChild
my_xml.firstChild
Read-only; evaluates the specified XML object and references the first child in the parent node’s child list. If the node
does not have children, this property is
null. If the node is a text node, this property is null. You cannot use this
property to manipulate child nodes; use the
appendChild(), insertBefore(), and removeNode() methods
instead.
Availability
Flash Media Server 2
Example
The following example shows how to use
XML.firstChild to loop through a node’s child nodes:
Commenti su questo manuale