electric.xml
Class NodeList

java.lang.Object
  extended byelectric.xml.NodeList
All Implemented Interfaces:
org.w3c.dom.NamedNodeMap, org.w3c.dom.NodeList, java.io.Serializable

public final class NodeList
extends java.lang.Object
implements java.io.Serializable, org.w3c.dom.NodeList, org.w3c.dom.NamedNodeMap

NodeList is a doubly-linked list of Nodes, and includes methods for adding, replacing and removing nodes.

Author:
webMethods
See Also:
Serialized Form

Field Summary
 Node first
           
 Node last
           
 
Constructor Summary
NodeList()
           
 
Method Summary
 void addSiblingNode(Node node, Node newNode)
          Append the new node as a sibling of the existing node.
 void append(Node node)
          Append the specified node to the end of this list.
 void clear()
          Remove all the nodes.
 int getLength()
          Return the number of nodes in the list.
 org.w3c.dom.Node getNamedItem(java.lang.String name)
          Return the node with the specified name, or null if not found
 org.w3c.dom.Node getNamedItemNS(java.lang.String namespaceURI, java.lang.String localName)
          Retrieves a node specified by local name and namespace URI.
 void insert(Node node)
          Insert the specified node at the beginning of this list.
 void insertSiblingNode(Node node, Node newNode)
          Insert the new node as a sibling of the existing node.
 boolean isEmpty()
          Return true if this list is empty.
 org.w3c.dom.Node item(int index)
          Return the indexth item in the collection.
 void remove(Node node)
          Remove the specified node from this list.
 org.w3c.dom.Node removeNamedItem(java.lang.String name)
          Removes a node specified by name.
 org.w3c.dom.Node removeNamedItemNS(java.lang.String namespaceURI, java.lang.String localName)
          Removes a node specified by local name and namespace URI.
 void replace(Node oldNode, Node newNode)
          Replace the old node with the new node in this list.
 org.w3c.dom.Node setNamedItem(org.w3c.dom.Node node)
          Adds a node using its nodeName attribute.
 org.w3c.dom.Node setNamedItemNS(org.w3c.dom.Node node)
          Adds a node using its namespaceURI and localName.
 int size()
          Return the number of nodes in this list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

first

public Node first

last

public Node last
Constructor Detail

NodeList

public NodeList()
Method Detail

isEmpty

public boolean isEmpty()
Return true if this list is empty.


append

public void append(Node node)
Append the specified node to the end of this list. If the new node was already in a document, remove it first.

Parameters:
node - The node to append.

insert

public void insert(Node node)
Insert the specified node at the beginning of this list. If the new node was already in a document, remove it first.

Parameters:
node - The node to insert.

remove

public void remove(Node node)
Remove the specified node from this list.

Parameters:
node - The node to remove.

replace

public void replace(Node oldNode,
                    Node newNode)
Replace the old node with the new node in this list. If the new node was already in a document, remove it first.

Parameters:
oldNode - The node to replace.
newNode - The new node.

addSiblingNode

public void addSiblingNode(Node node,
                           Node newNode)
Append the new node as a sibling of the existing node. If the new node was already in a document, remove it first.

Parameters:
node - The existing node.
newNode - The new node.

insertSiblingNode

public void insertSiblingNode(Node node,
                              Node newNode)
Insert the new node as a sibling of the existing node. If the new node was already in a document, remove it first.

Parameters:
node - The existing node.
newNode - The new node.

size

public int size()
Return the number of nodes in this list.


clear

public void clear()
Remove all the nodes.


getLength

public int getLength()
Return the number of nodes in the list. The range of valid child node indices is 0 to length - 1 inclusive.

Specified by:
getLength in interface org.w3c.dom.NodeList

item

public org.w3c.dom.Node item(int index)
Return the indexth item in the collection. If index is greater than or equal to the number of nodes in the list, this returns null.

Specified by:
item in interface org.w3c.dom.NodeList
Parameters:
index - The index of the node to return.

getNamedItem

public org.w3c.dom.Node getNamedItem(java.lang.String name)
Return the node with the specified name, or null if not found

Specified by:
getNamedItem in interface org.w3c.dom.NamedNodeMap
Parameters:
name - The name of the node to return.

setNamedItem

public org.w3c.dom.Node setNamedItem(org.w3c.dom.Node node)
Adds a node using its nodeName attribute. If a node with that name is already present in this map, it is replaced by the new one. As the nodeName attribute is used to derive the name which the node must be stored under, multiple nodes of certain types (those that have a "special" string value) cannot be stored as the names would clash. This is seen as preferable to allowing nodes to be aliased.

Specified by:
setNamedItem in interface org.w3c.dom.NamedNodeMap
Parameters:
node - The node to be added.

removeNamedItem

public org.w3c.dom.Node removeNamedItem(java.lang.String name)
Removes a node specified by name. When this map contains the attributes attached to an element, if the removed attribute is known to have a default value, an attribute immediately appears containing the default value as well as the corresponding namespace URI, local name, and prefix when applicable.

Specified by:
removeNamedItem in interface org.w3c.dom.NamedNodeMap
Parameters:
name - The name of the node to remove.

getNamedItemNS

public org.w3c.dom.Node getNamedItemNS(java.lang.String namespaceURI,
                                       java.lang.String localName)
Retrieves a node specified by local name and namespace URI.

Specified by:
getNamedItemNS in interface org.w3c.dom.NamedNodeMap
Parameters:
namespaceURI - The namespace URI.
localName - The local name.

setNamedItemNS

public org.w3c.dom.Node setNamedItemNS(org.w3c.dom.Node node)
Adds a node using its namespaceURI and localName. If a node with that namespace URI and that local name is already present in this map, it is replaced by the new one.

Specified by:
setNamedItemNS in interface org.w3c.dom.NamedNodeMap
Parameters:
node - The node to add.

removeNamedItemNS

public org.w3c.dom.Node removeNamedItemNS(java.lang.String namespaceURI,
                                          java.lang.String localName)
Removes a node specified by local name and namespace URI. A removed attribute may be known to have a default value when this map contains the attributes attached to an element, as returned by the attributes attribute of the Node interface. If so, an attribute immediately appears containing the default value as well as the corresponding namespace URI, local name, and prefix when applicable.

Specified by:
removeNamedItemNS in interface org.w3c.dom.NamedNodeMap
Parameters:
namespaceURI - The namespace URI.
localName - The local name.


copyright© 2001-2004 by webMethods All Rights Reserved.