deprecated/buildtools/buildsystemtools/lib/XML/DOM/Node.pod
author lorewang
Thu, 11 Nov 2010 11:26:32 +0800
changeset 677 44e49837144a
parent 655 3f65fd25dfd4
permissions -rw-r--r--
update release info
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
655
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     1
=head1 NAME
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     2
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     3
XML::DOM::Node - Super class of all nodes in XML::DOM
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     4
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     5
=head1 DESCRIPTION
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     6
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     7
XML::DOM::Node is the super class of all nodes in an XML::DOM document.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     8
This means that all nodes that subclass XML::DOM::Node also inherit all
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     9
the methods that XML::DOM::Node implements.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    10
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    11
=head2 GLOBAL VARIABLES
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    12
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    13
=over 4
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    14
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    15
=item @NodeNames
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    16
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    17
The variable @XML::DOM::Node::NodeNames maps the node type constants to strings.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    18
It is used by XML::DOM::Node::getNodeTypeName.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    19
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    20
=back
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    21
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    22
=head2 METHODS
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    23
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    24
=over 4
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    25
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    26
=item getNodeType
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    27
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    28
Return an integer indicating the node type. See XML::DOM constants.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    29
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    30
=item getNodeName
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    31
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    32
Return a property or a hardcoded string, depending on the node type.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    33
Here are the corresponding functions or values:
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    34
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    35
 Attr			getName
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    36
 AttDef			getName
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    37
 AttlistDecl		getName
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    38
 CDATASection		"#cdata-section"
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    39
 Comment		"#comment"
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    40
 Document		"#document"
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    41
 DocumentType		getNodeName
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    42
 DocumentFragment	"#document-fragment"
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    43
 Element		getTagName
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    44
 ElementDecl		getName
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    45
 EntityReference	getEntityName
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    46
 Entity			getNotationName
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    47
 Notation		getName
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    48
 ProcessingInstruction	getTarget
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    49
 Text			"#text"
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    50
 XMLDecl		"#xml-declaration"
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    51
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    52
B<Not In DOM Spec>: AttDef, AttlistDecl, ElementDecl and XMLDecl were added for
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    53
completeness.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    54
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    55
=item getNodeValue and setNodeValue (value)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    56
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    57
Returns a string or undef, depending on the node type. This method is provided 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    58
for completeness. In other languages it saves the programmer an upcast.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    59
The value is either available thru some other method defined in the subclass, or
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    60
else undef is returned. Here are the corresponding methods: 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    61
Attr::getValue, Text::getData, CDATASection::getData, Comment::getData, 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    62
ProcessingInstruction::getData.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    63
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    64
=item getParentNode and setParentNode (parentNode)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    65
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    66
The parent of this node. All nodes, except Document,
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    67
DocumentFragment, and Attr may have a parent. However, if a
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    68
node has just been created and not yet added to the tree, or
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    69
if it has been removed from the tree, this is undef.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    70
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    71
=item getChildNodes
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    72
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    73
A NodeList that contains all children of this node. If there
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    74
are no children, this is a NodeList containing no nodes. The
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    75
content of the returned NodeList is "live" in the sense that,
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    76
for instance, changes to the children of the node object that
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    77
it was created from are immediately reflected in the nodes
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    78
returned by the NodeList accessors; it is not a static
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    79
snapshot of the content of the node. This is true for every
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    80
NodeList, including the ones returned by the
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    81
getElementsByTagName method.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    82
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    83
NOTE: this implementation does not return a "live" NodeList for
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    84
getElementsByTagName. See L<CAVEATS>.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    85
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    86
When this method is called in a list context, it returns a regular perl list
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    87
containing the child nodes. Note that this list is not "live". E.g.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    88
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    89
 @list = $node->getChildNodes;	      # returns a perl list
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    90
 $nodelist = $node->getChildNodes;    # returns a NodeList (object reference)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    91
 for my $kid ($node->getChildNodes)   # iterate over the children of $node
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    92
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    93
=item getFirstChild
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    94
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    95
The first child of this node. If there is no such node, this returns undef.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    96
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    97
=item getLastChild
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    98
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    99
The last child of this node. If there is no such node, this returns undef.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   100
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   101
=item getPreviousSibling
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   102
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   103
The node immediately preceding this node. If there is no such 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   104
node, this returns undef.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   105
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   106
=item getNextSibling
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   107
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   108
The node immediately following this node. If there is no such node, this returns 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   109
undef.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   110
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   111
=item getAttributes
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   112
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   113
A NamedNodeMap containing the attributes (Attr nodes) of this node 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   114
(if it is an Element) or undef otherwise.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   115
Note that adding/removing attributes from the returned object, also adds/removes
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   116
attributes from the Element node that the NamedNodeMap came from.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   117
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   118
=item getOwnerDocument
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   119
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   120
The Document object associated with this node. This is also
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   121
the Document object used to create new nodes. When this node
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   122
is a Document this is undef.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   123
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   124
=item insertBefore (newChild, refChild)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   125
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   126
Inserts the node newChild before the existing child node
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   127
refChild. If refChild is undef, insert newChild at the end of
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   128
the list of children.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   129
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   130
If newChild is a DocumentFragment object, all of its children
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   131
are inserted, in the same order, before refChild. If the
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   132
newChild is already in the tree, it is first removed.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   133
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   134
Return Value: The node being inserted.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   135
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   136
DOMExceptions:
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   137
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   138
=over 4
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   139
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   140
=item * HIERARCHY_REQUEST_ERR
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   141
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   142
Raised if this node is of a type that does not allow children of the type of
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   143
the newChild node, or if the node to insert is one of this node's ancestors.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   144
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   145
=item * WRONG_DOCUMENT_ERR
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   146
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   147
Raised if newChild was created from a different document than the one that 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   148
created this node.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   149
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   150
=item * NO_MODIFICATION_ALLOWED_ERR
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   151
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   152
Raised if this node is readonly.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   153
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   154
=item * NOT_FOUND_ERR
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   155
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   156
Raised if refChild is not a child of this node.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   157
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   158
=back
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   159
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   160
=item replaceChild (newChild, oldChild)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   161
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   162
Replaces the child node oldChild with newChild in the list of
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   163
children, and returns the oldChild node. If the newChild is
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   164
already in the tree, it is first removed.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   165
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   166
Return Value: The node replaced.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   167
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   168
DOMExceptions:
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   169
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   170
=over 4
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   171
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   172
=item * HIERARCHY_REQUEST_ERR
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   173
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   174
Raised if this node is of a type that does not allow children of the type of
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   175
the newChild node, or it the node to put in is one of this node's ancestors.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   176
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   177
=item * WRONG_DOCUMENT_ERR
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   178
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   179
Raised if newChild was created from a different document than the one that 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   180
created this node.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   181
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   182
=item * NO_MODIFICATION_ALLOWED_ERR
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   183
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   184
Raised if this node is readonly.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   185
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   186
=item * NOT_FOUND_ERR
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   187
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   188
Raised if oldChild is not a child of this node.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   189
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   190
=back
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   191
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   192
=item removeChild (oldChild)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   193
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   194
Removes the child node indicated by oldChild from the list of
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   195
children, and returns it.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   196
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   197
Return Value: The node removed.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   198
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   199
DOMExceptions:
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   200
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   201
=over 4
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   202
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   203
=item * NO_MODIFICATION_ALLOWED_ERR
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   204
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   205
Raised if this node is readonly.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   206
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   207
=item * NOT_FOUND_ERR
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   208
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   209
Raised if oldChild is not a child of this node.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   210
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   211
=back
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   212
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   213
=item appendChild (newChild)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   214
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   215
Adds the node newChild to the end of the list of children of
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   216
this node. If the newChild is already in the tree, it is
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   217
first removed. If it is a DocumentFragment object, the entire contents of 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   218
the document fragment are moved into the child list of this node
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   219
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   220
Return Value: The node added.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   221
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   222
DOMExceptions:
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   223
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   224
=over 4
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   225
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   226
=item * HIERARCHY_REQUEST_ERR
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   227
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   228
Raised if this node is of a type that does not allow children of the type of
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   229
the newChild node, or if the node to append is one of this node's ancestors.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   230
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   231
=item * WRONG_DOCUMENT_ERR
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   232
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   233
Raised if newChild was created from a different document than the one that 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   234
created this node.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   235
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   236
=item * NO_MODIFICATION_ALLOWED_ERR
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   237
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   238
Raised if this node is readonly.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   239
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   240
=back
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   241
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   242
=item hasChildNodes
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   243
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   244
This is a convenience method to allow easy determination of
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   245
whether a node has any children.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   246
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   247
Return Value: 1 if the node has any children, 0 otherwise.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   248
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   249
=item cloneNode (deep)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   250
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   251
Returns a duplicate of this node, i.e., serves as a generic
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   252
copy constructor for nodes. The duplicate node has no parent
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   253
(parentNode returns undef.).
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   254
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   255
Cloning an Element copies all attributes and their values,
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   256
including those generated by the XML processor to represent
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   257
defaulted attributes, but this method does not copy any text
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   258
it contains unless it is a deep clone, since the text is
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   259
contained in a child Text node. Cloning any other type of
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   260
node simply returns a copy of this node.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   261
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   262
Parameters: 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   263
 I<deep>   If true, recursively clone the subtree under the specified node.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   264
If false, clone only the node itself (and its attributes, if it is an Element).
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   265
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   266
Return Value: The duplicate node.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   267
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   268
=item normalize
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   269
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   270
Puts all Text nodes in the full depth of the sub-tree
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   271
underneath this Element into a "normal" form where only
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   272
markup (e.g., tags, comments, processing instructions, CDATA
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   273
sections, and entity references) separates Text nodes, i.e.,
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   274
there are no adjacent Text nodes. This can be used to ensure
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   275
that the DOM view of a document is the same as if it were
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   276
saved and re-loaded, and is useful when operations (such as
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   277
XPointer lookups) that depend on a particular document tree
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   278
structure are to be used.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   279
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   280
B<Not In DOM Spec>: In the DOM Spec this method is defined in the Element and 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   281
Document class interfaces only, but it doesn't hurt to have it here...
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   282
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   283
=item getElementsByTagName (name [, recurse])
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   284
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   285
Returns a NodeList of all descendant elements with a given
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   286
tag name, in the order in which they would be encountered in
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   287
a preorder traversal of the Element tree.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   288
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   289
Parameters:
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   290
 I<name>  The name of the tag to match on. The special value "*" matches all tags.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   291
 I<recurse>  Whether it should return only direct child nodes (0) or any descendant that matches the tag name (1). This argument is optional and defaults to 1. It is not part of the DOM spec.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   292
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   293
Return Value: A list of matching Element nodes.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   294
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   295
NOTE: this implementation does not return a "live" NodeList for
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   296
getElementsByTagName. See L<CAVEATS>.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   297
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   298
When this method is called in a list context, it returns a regular perl list
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   299
containing the result nodes. E.g.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   300
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   301
 @list = $node->getElementsByTagName("tag");       # returns a perl list
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   302
 $nodelist = $node->getElementsByTagName("tag");   # returns a NodeList (object ref.)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   303
 for my $elem ($node->getElementsByTagName("tag")) # iterate over the result nodes
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   304
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   305
=back
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   306
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   307
=head2 Additional methods not in the DOM Spec
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   308
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   309
=over 4
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   310
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   311
=item getNodeTypeName
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   312
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   313
Return the string describing the node type. 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   314
E.g. returns "ELEMENT_NODE" if getNodeType returns ELEMENT_NODE.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   315
It uses @XML::DOM::Node::NodeNames.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   316
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   317
=item toString
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   318
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   319
Returns the entire subtree as a string.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   320
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   321
=item printToFile (filename)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   322
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   323
Prints the entire subtree to the file with the specified filename.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   324
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   325
Croaks: if the file could not be opened for writing.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   326
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   327
=item printToFileHandle (handle)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   328
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   329
Prints the entire subtree to the file handle.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   330
E.g. to print to STDOUT:
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   331
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   332
 $node->printToFileHandle (\*STDOUT);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   333
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   334
=item print (obj)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   335
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   336
Prints the entire subtree using the object's print method. E.g to print to a
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   337
FileHandle object:
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   338
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   339
 $f = new FileHandle ("file.out", "w");
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   340
 $node->print ($f);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   341
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   342
=item getChildIndex (child)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   343
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   344
Returns the index of the child node in the list returned by getChildNodes.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   345
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   346
Return Value: the index or -1 if the node is not found.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   347
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   348
=item getChildAtIndex (index)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   349
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   350
Returns the child node at the specifed index or undef.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   351
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   352
=item addText (text)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   353
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   354
Appends the specified string to the last child if it is a Text node, or else 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   355
appends a new Text node (with the specified text.)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   356
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   357
Return Value: the last child if it was a Text node or else the new Text node.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   358
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   359
=item dispose
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   360
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   361
Removes all circular references in this node and its descendants so the 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   362
objects can be claimed for garbage collection. The objects should not be used
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   363
afterwards.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   364
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   365
=item setOwnerDocument (doc)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   366
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   367
Sets the ownerDocument property of this node and all its children (and 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   368
attributes etc.) to the specified document.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   369
This allows the user to cut and paste document subtrees between different
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   370
XML::DOM::Documents. The node should be removed from the original document
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   371
first, before calling setOwnerDocument.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   372
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   373
This method does nothing when called on a Document node.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   374
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   375
=item isAncestor (parent)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   376
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   377
Returns 1 if parent is an ancestor of this node or if it is this node itself.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   378
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   379
=item expandEntityRefs (str)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   380
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   381
Expands all the entity references in the string and returns the result.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   382
The entity references can be character references (e.g. "&#123;" or "&#x1fc2"),
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   383
default entity references ("&quot;", "&gt;", "&lt;", "&apos;" and "&amp;") or
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   384
entity references defined in Entity objects as part of the DocumentType of
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   385
the owning Document. Character references are expanded into UTF-8.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   386
Parameter entity references (e.g. %ent;) are not expanded.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   387
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   388
=item to_sax ( %HANDLERS )
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   389
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   390
E.g.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   391
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   392
 $node->to_sax (DocumentHandler => $my_handler, 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   393
		Handler => $handler2 );
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   394
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   395
%HANDLERS may contain the following handlers:
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   396
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   397
=over 4
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   398
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   399
=item * DocumentHandler
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   400
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   401
=item * DTDHandler
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   402
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   403
=item * EntityResolver
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   404
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   405
=item * Handler 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   406
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   407
Default handler when one of the above is not specified
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   408
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   409
=back
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   410
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   411
Each XML::DOM::Node generates the appropriate SAX callbacks (for the
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   412
appropriate SAX handler.) Different SAX handlers can be plugged in to
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   413
accomplish different things, e.g. L<XML::Checker> would check the node 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   414
(currently only Document and Element nodes are supported), L<XML::Handler::BuildDOM>
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   415
would create a new DOM subtree (thereby, in essence, copying the Node)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   416
and in the near future, XML::Writer could print the node.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   417
All Perl SAX related work is still in flux, so this interface may change a 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   418
little.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   419
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   420
See PerlSAX for the description of the SAX interface.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   421
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   422
=item check ( [$checker] )
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   423
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   424
See descriptions for check() in L<XML::DOM::Document> and L<XML::DOM::Element>.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   425
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   426
=item xql ( @XQL_OPTIONS )
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   427
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   428
To use the xql method, you must first I<use> L<XML::XQL> and L<XML::XQL::DOM>.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   429
This method is basically a shortcut for:
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   430
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   431
 $query = new XML::XQL::Query ( @XQL_OPTIONS );
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   432
 return $query->solve ($node);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   433
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   434
If the first parameter in @XQL_OPTIONS is the XQL expression, you can leave off
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   435
the 'Expr' keyword, so:
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   436
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   437
 $node->xql ("doc//elem1[@attr]", @other_options);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   438
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   439
is identical to:
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   440
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   441
 $node->xql (Expr => "doc//elem1[@attr]", @other_options);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   442
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   443
See L<XML::XQL::Query> for other available XQL_OPTIONS.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   444
See L<XML::XQL> and L<XML::XQL::Tutorial> for more info.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   445
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   446
=item isHidden ()
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   447
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   448
Whether the node is hidden.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   449
See L<Hidden Nodes|XML::DOM/_Hidden_Nodes_> for details.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   450
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   451
=back