Name
XML.nodeType Property — the type of the current node
Availability
Flash 5
Synopsis
theNode.nodeType
Access
Read-only
Description
The
nodeType
is an integer
property that returns theNode
’s
type. Since only two node types are supported by
ActionScript—element
nodes and text
nodes—nodeName
has only two possible values:
1, if the node is an element node; and 3, if the node is a text node.
These values may seem arbitrary, but they are actually the
appropriate values as stipulated by the DOM. For reference, the other
node types in the DOM are listed in Table 20.13.
Table 20-13. DOM Node Types
Node Description |
Node Type Code |
---|---|
ELEMENT_NODE* |
1 |
ATTRIBUTE_NODE |
2 |
TEXT_NODE* |
3 |
CDATA_SECTION_NODE |
4 |
ENTITY_REFERENCE_NODE |
5 |
ENTITY_NODE |
6 |
PROCESSING_INSTRUCTION_NODE |
7 |
COMMENT_NODE |
8 |
DOCUMENT_NODE |
9 |
DOCUMENT_TYPE_NODE |
10 |
DOCUMENT_FRAGMENT_NODE |
11 |
NOTATION_NODE |
12 |
*Supported by Flash. Technically, ActionScript implements so-called
attribute, document, and
document_type nodes in addition to
element and text nodes, but
we don’t have direct access to them as objects. For example, we
may manipulate the attributes of a node through the
attributes
property, but we do not have direct
access to attribute nodes themselves. Similarly,
we have access to the DOCTYPE
tag of a document
through the docTypeDecl
property, but we do not
have direct access to document_type itself.
Element nodes correspond to XML or HTML tags.
For example, in the XML fragment <P>what is ...
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.