APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.org.apache.xml.internal.dtm.ref

public Class DTMNamedNodeMap

extends Object
implements NamedNodeMap
Class Inheritance
All Implemented Interfaces
org.w3c.dom.NamedNodeMap
Imports
com.sun.org.apache.xml.internal.dtm.DTM, org.w3c.dom.DOMException, .NamedNodeMap, .Node

DTMNamedNodeMap is a quickie (as opposed to quick) implementation of the DOM's NamedNodeMap interface, intended to support DTMProxy's getAttributes() call.

***** Note: this does _not_ current attempt to cache any of the data; if you ask for attribute 27 and then 28, you'll have to rescan the first 27. It should probably at least keep track of the last one retrieved, and possibly buffer the whole array.

***** Also note that there's no fastpath for the by-name query; we search linearly until we find it or fail to find it. Again, that could be optimized at some cost in object creation/storage.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public class
DTMNamedNodeMap.DTMException

Simple implementation of DOMException.

Field Summary

Modifier and TypeField and Description
pack-priv DTM
dtm

The DTM for this node.

pack-priv int
element

The DTM element handle.

pack-priv short
m_count

The number of nodes in this map.

Constructor Summary

AccessConstructor and Description
public
DTMNamedNodeMap(DTM
The DTM Reference, must be non-null.
dtm
,
int
The DTM element handle.
element
)

Create a getAttributes NamedNodeMap for a given DTM element node

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

The number of nodes in this map.
getLength
()

Implements org.w3c.dom.NamedNodeMap.getLength.

Return the number of Attributes on this Element

public Node

Returns:

A Node (of any type) with the specified nodeName, or null if it does not identify any node in this map.
getNamedItem
(String
The nodeName of a node to retrieve.
name
)

Implements org.w3c.dom.NamedNodeMap.getNamedItem.

Retrieves a node specified by name.

public Node

Returns:

A Node (of any type) with the specified local name and namespace URI, or null if they do not identify any node in this map.
getNamedItemNS
(String
The namespace URI of the node to retrieve.
namespaceURI
,
String
The local name of the node to retrieve.
localName
)

Implements org.w3c.dom.NamedNodeMap.getNamedItemNS.

Retrieves a node specified by local name and namespace URI.

public Node

Returns:

The node at the indexth position in the map, or null if that is not a valid index.
item
(int
The index of the requested item.
i
)

Implements org.w3c.dom.NamedNodeMap.item.

Returns the indexth item in the map.

public Node

Returns:

The node removed from this map if a node with such a name exists.
removeNamedItem
(String
The nodeName of the node to remove.
name
)

Implements org.w3c.dom.NamedNodeMap.removeNamedItem.

Removes a node specified by name.

public Node

Returns:

The node removed from this map if a node with such a local name and namespace URI exists.
removeNamedItemNS
(String
The namespace URI of the node to remove.
namespaceURI
,
String
The local name of the node to remove.
localName
)

Implements org.w3c.dom.NamedNodeMap.removeNamedItemNS.

Removes a node specified by local name and namespace URI.

public Node

Returns:

If the new Node replaces an existing node the replaced Node is returned, otherwise null is returned.
setNamedItem
(Node
node to store in this map. The node will later be accessible using the value of its nodeName attribute.
newNode
)

Implements org.w3c.dom.NamedNodeMap.setNamedItem.

Adds a node using its nodeName attribute.

public Node

Returns:

If the new Node replaces an existing node the replaced Node is returned, otherwise null is returned.
setNamedItemNS
(Node
A node to store in this map. The node will later be accessible using the value of its namespaceURI and localName attributes.
arg
)

Implements org.w3c.dom.NamedNodeMap.setNamedItemNS.

Adds a node using its namespaceURI and localName.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dtmback to summary
pack-priv DTM dtm

The DTM for this node.

elementback to summary
pack-priv int element

The DTM element handle.

m_countback to summary
pack-priv short m_count

The number of nodes in this map.

Constructor Detail

DTMNamedNodeMapback to summary
public DTMNamedNodeMap(DTM dtm, int element)

Create a getAttributes NamedNodeMap for a given DTM element node

Parameters
dtm:DTM

The DTM Reference, must be non-null.

element:int

The DTM element handle.

Method Detail

getLengthback to summary
public int getLength()

Implements org.w3c.dom.NamedNodeMap.getLength.

Return the number of Attributes on this Element

Returns:int

The number of nodes in this map.

getNamedItemback to summary
public Node getNamedItem(String name)

Implements org.w3c.dom.NamedNodeMap.getNamedItem.

Retrieves a node specified by name.

Parameters
name:String

The nodeName of a node to retrieve.

Returns:Node

A Node (of any type) with the specified nodeName, or null if it does not identify any node in this map.

getNamedItemNSback to summary
public Node getNamedItemNS(String namespaceURI, String localName)

Implements org.w3c.dom.NamedNodeMap.getNamedItemNS.

Retrieves a node specified by local name and namespace URI. HTML-only DOM implementations do not need to implement this method.

Parameters
namespaceURI:String

The namespace URI of the node to retrieve.

localName:String

The local name of the node to retrieve.

Returns:Node

A Node (of any type) with the specified local name and namespace URI, or null if they do not identify any node in this map.

Since
DOM Level 2
itemback to summary
public Node item(int i)

Implements org.w3c.dom.NamedNodeMap.item.

Returns the indexth item in the map. If index is greater than or equal to the number of nodes in this map, this returns null.

Parameters
i:int

The index of the requested item.

Returns:Node

The node at the indexth position in the map, or null if that is not a valid index.

removeNamedItemback to summary
public Node removeNamedItem(String name)

Implements org.w3c.dom.NamedNodeMap.removeNamedItem.

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.

Parameters
name:String

The nodeName of the node to remove.

Returns:Node

The node removed from this map if a node with such a name exists.

Exceptions
DOMException:
NOT_FOUND_ERR: Raised if there is no node named name in this map.
NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
removeNamedItemNSback to summary
public Node removeNamedItemNS(String namespaceURI, String localName) throws DOMException

Implements org.w3c.dom.NamedNodeMap.removeNamedItemNS.

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.
HTML-only DOM implementations do not need to implement this method.

Parameters
namespaceURI:String

The namespace URI of the node to remove.

localName:String

The local name of the node to remove.

Returns:Node

The node removed from this map if a node with such a local name and namespace URI exists.

Exceptions
DOMException:
NOT_FOUND_ERR: Raised if there is no node with the specified namespaceURI and localName in this map.
NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
Since
DOM Level 2
setNamedItemback to summary
public Node setNamedItem(Node newNode)

Implements org.w3c.dom.NamedNodeMap.setNamedItem.

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.

Parameters
newNode:Node

node to store in this map. The node will later be accessible using the value of its nodeName attribute.

Returns:Node

If the new Node replaces an existing node the replaced Node is returned, otherwise null is returned.

Exceptions
DOMException:
WRONG_DOCUMENT_ERR: Raised if arg was created from a different document than the one that created this map.
NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
INUSE_ATTRIBUTE_ERR: Raised if arg is an Attr that is already an attribute of another Element object. The DOM user must explicitly clone Attr nodes to re-use them in other elements.
setNamedItemNSback to summary
public Node setNamedItemNS(Node arg) throws DOMException

Implements org.w3c.dom.NamedNodeMap.setNamedItemNS.

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.
HTML-only DOM implementations do not need to implement this method.

Parameters
arg:Node

A node to store in this map. The node will later be accessible using the value of its namespaceURI and localName attributes.

Returns:Node

If the new Node replaces an existing node the replaced Node is returned, otherwise null is returned.

Exceptions
DOMException:
WRONG_DOCUMENT_ERR: Raised if arg was created from a different document than the one that created this map.
NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
INUSE_ATTRIBUTE_ERR: Raised if arg is an Attr that is already an attribute of another Element object. The DOM user must explicitly clone Attr nodes to re-use them in other elements.
Since
DOM Level 2
com.sun.org.apache.xml.internal.dtm.ref back to summary

public Class DTMNamedNodeMap.DTMException

extends DOMException
Class Inheritance

Simple implementation of DOMException.

Field Summary

Modifier and TypeField and Description
pack-priv static final long
Inherited from org.w3c.dom.DOMException:
codeDOMSTRING_SIZE_ERRHIERARCHY_REQUEST_ERRINDEX_SIZE_ERRINUSE_ATTRIBUTE_ERRINVALID_ACCESS_ERRINVALID_CHARACTER_ERRINVALID_MODIFICATION_ERRINVALID_STATE_ERRNAMESPACE_ERRNO_DATA_ALLOWED_ERRNO_MODIFICATION_ALLOWED_ERRNOT_FOUND_ERRNOT_SUPPORTED_ERRSYNTAX_ERRTYPE_MISMATCH_ERRVALIDATION_ERRWRONG_DOCUMENT_ERR

Constructor Summary

AccessConstructor and Description
public
DTMException(short code, String message)

Constructs a DOM/DTM exception.

public
DTMException(short code)

Constructor DTMException

Field Detail

serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Hides org.w3c.dom.DOMException.serialVersionUID.

Constructor Detail

DTMExceptionback to summary
public DTMException(short code, String message)

Constructs a DOM/DTM exception.

DTMExceptionback to summary
public DTMException(short code)

Constructor DTMException