
XML.cloneNode() Method
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Alphabetical Language Reference
|
923
However, our example traverses only the first level of theNode’s hierarchy. The examples
under the
XML.nextSibling entry show how to access all the nodes below theNode.If
theNode has no children, theNode.childNodes.length is 0.
Usage
Remember that empty text nodes, representing the whitespace used to format XML source
code, also show up in a
childNode list. For example, in the following XML source, empty
text nodes are created by the whitespace after the
BOOK start tag and the TITLE, AUTHOR, and
PUBLISHER end tags:
<BOOK>
<TITLE>ActionScript for Flash MX: The Definitive Guide</TITLE>
<AUTHOR SALUTATION="Mr.">Colin Moock</AUTHOR>
<PUBLISHER>O'Reilly</PUBLISHER>
</BOOK>
Hence, the first child node of BOOK is an empty text node; the second child is TITLE.To
remove whitespace, use
XML.ignoreWhite.
Bugs
In Flash Player 5, an XML document with an XML declaration (<?xml version="1.0"?>) has
a
childNodes[0] of undefined. The first child of the document is stored erroneously in
childNodes[1]. This bug was fixed in Flash Player 6.
See Also
XML.firstChild, XML.hasChildNodes(), XML.lastChild, XML.nextSibling, XML.
previousSibling
XML.cloneNode() Method
create an independent copy of a node
Flash 5
theNode.cloneNode(deep)
Arguments
deep A Boolean indicating ...