Top Description Fields Constructors Methods
org.apache.xerces.dom

public Class AttributeMap

extends NamedNodeMapImpl
Class Inheritance
Imports
java.util.ArrayList, .List, org.w3c.dom.DOMException, .Node

AttributeMap inherits from NamedNodeMapImpl and extends it to deal with the specifics of storing attributes. These are:

This class doesn't directly support mutation events, however, it notifies the document when mutations are performed so that the document class do so.

Version
$Id: AttributeMap.java 612590 2008-01-16 22:16:09Z mrglavas $

Field Summary

Modifier and TypeField and Description
pack-priv static final long
Inherited from org.apache.xerces.dom.NamedNodeMapImpl:
CHANGEDflagsHASDEFAULTSnodesownerNodeREADONLY

Constructor Summary

AccessConstructor and Description
protected
AttributeMap(ElementImpl ownerNode, NamedNodeMapImpl defaults)

Constructs a named node map.

Method Summary

Modifier and TypeMethod and Description
protected final int
protected void
cloneContent(NamedNodeMapImpl srcmap)

Overrides org.apache.xerces.dom.NamedNodeMapImpl.cloneContent.

Override parent's method to set the ownerNode correctly
public NamedNodeMapImpl
cloneMap(NodeImpl ownerNode)

Overrides org.apache.xerces.dom.NamedNodeMapImpl.cloneMap.

Cloning a NamedNodeMap is a DEEP OPERATION; it always clones all the nodes contained in the map.
protected final Node
internalRemoveNamedItem(String name, boolean raiseEx)

Internal removeNamedItem method allowing to specify whether an exception must be thrown if the specified name is not found.

protected final Node
internalRemoveNamedItemNS(String namespaceURI, String name, boolean raiseEx)

Internal removeNamedItemNS method allowing to specify whether an exception must be thrown if the specified local name and namespace URI is not found.

pack-priv void
moveSpecifiedAttributes(AttributeMap srcmap)

Move specified attributes from the given map to this one

protected void
reconcileDefaults(NamedNodeMapImpl
The default attributes map to sync with.
defaults
)

Get this AttributeMap in sync with the given "defaults" map.

private final Node
remove(AttrImpl attr, int index, boolean addDefault)

protected Node

Returns:

Removed node
removeItem
(Node
The node to remove
item
,
boolean
true -- magically add default attribute
addDefault
)

NON-DOM: Remove the node object NOTE: Specifically removes THIS NODE -- not the node with this name, nor the node with these contents.

public Node
removeNamedItem(String
The nodeName of the node to remove.
name
)

Overrides org.apache.xerces.dom.NamedNodeMapImpl.removeNamedItem.

Implements org.w3c.dom.NamedNodeMap.removeNamedItem.

Removes a node specified by name.
public Node

Returns:

Node The node removed from the map if a node with such a local name and namespace URI exists.
removeNamedItemNS
(String
The namespace URI of the node to remove. When it is null or an empty string, this method behaves like removeNamedItem.
namespaceURI
,
String
The local name of the node to remove. If the removed attribute is known to have a default value, an attribute immediately appears containing the default value.
name
)

Overrides org.apache.xerces.dom.NamedNodeMapImpl.removeNamedItemNS.

Implements org.w3c.dom.NamedNodeMap.removeNamedItemNS.

Introduced in DOM Level 2.
pack-priv Node
safeRemoveNamedItem(String name)

Same as removeNamedItem except that it simply returns null if the specified name is not found.

pack-priv Node
safeRemoveNamedItemNS(String namespaceURI, String name)

Same as removeNamedItem except that it simply returns null if the specified local name and namespace URI is not found.

public Node

Returns:

If the new Node replaces an existing node the replaced Node is returned, otherwise null is returned.
setNamedItem
(Node
An Attr node to store in this map.
arg
)

Overrides org.apache.xerces.dom.NamedNodeMapImpl.setNamedItem.

Implements org.w3c.dom.NamedNodeMap.setNamedItem.

Adds an attribute 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 a named node map.
arg
)

Overrides org.apache.xerces.dom.NamedNodeMapImpl.setNamedItemNS.

Implements org.w3c.dom.NamedNodeMap.setNamedItemNS.

Adds an attribute using its namespaceURI and localName.
Inherited from org.apache.xerces.dom.NamedNodeMapImpl:
changedchangedcloneMapfindNamePointfindNamePointgetItemgetLengthgetNamedItemgetNamedItemIndexgetNamedItemNSgetReadOnlyhasDefaultshasDefaultsisReadOnlyisReadOnlyitemprecedesremoveAllremoveItemsetOwnerDocumentsetReadOnly

Field Detail

serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Hides org.apache.xerces.dom.NamedNodeMapImpl.serialVersionUID.

Serialization version.

Constructor Detail

AttributeMapback to summary
protected AttributeMap(ElementImpl ownerNode, NamedNodeMapImpl defaults)

Constructs a named node map.

Method Detail

addItemback to summary
protected final int addItem(Node arg)

Overrides org.apache.xerces.dom.NamedNodeMapImpl.addItem.

cloneContentback to summary
protected void cloneContent(NamedNodeMapImpl srcmap)

Overrides org.apache.xerces.dom.NamedNodeMapImpl.cloneContent.

Override parent's method to set the ownerNode correctly

cloneMapback to summary
public NamedNodeMapImpl cloneMap(NodeImpl ownerNode)

Overrides org.apache.xerces.dom.NamedNodeMapImpl.cloneMap.

Cloning a NamedNodeMap is a DEEP OPERATION; it always clones all the nodes contained in the map.

internalRemoveNamedItemback to summary
protected final Node internalRemoveNamedItem(String name, boolean raiseEx)

Internal removeNamedItem method allowing to specify whether an exception must be thrown if the specified name is not found.

internalRemoveNamedItemNSback to summary
protected final Node internalRemoveNamedItemNS(String namespaceURI, String name, boolean raiseEx)

Internal removeNamedItemNS method allowing to specify whether an exception must be thrown if the specified local name and namespace URI is not found.

moveSpecifiedAttributesback to summary
pack-priv void moveSpecifiedAttributes(AttributeMap srcmap)

Move specified attributes from the given map to this one

reconcileDefaultsback to summary
protected void reconcileDefaults(NamedNodeMapImpl defaults)

Get this AttributeMap in sync with the given "defaults" map.

Parameters
defaults:NamedNodeMapImpl

The default attributes map to sync with.

removeback to summary
private final Node remove(AttrImpl attr, int index, boolean addDefault)
removeItemback to summary
protected Node removeItem(Node item, boolean addDefault) throws DOMException

NON-DOM: Remove the node object NOTE: Specifically removes THIS NODE -- not the node with this name, nor the node with these contents. If node does not belong to this named node map, we throw a DOMException.

Parameters
item:Node

The node to remove

addDefault:boolean

true -- magically add default attribute

Returns:Node

Removed node

removeNamedItemback to summary
public Node removeNamedItem(String name) throws DOMException

Overrides org.apache.xerces.dom.NamedNodeMapImpl.removeNamedItem.

Implements org.w3c.dom.NamedNodeMap.removeNamedItem.

Doc from 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 name) throws DOMException

Overrides org.apache.xerces.dom.NamedNodeMapImpl.removeNamedItemNS.

Implements org.w3c.dom.NamedNodeMap.removeNamedItemNS.

Introduced in DOM Level 2.

Removes an attribute specified by local name and namespace URI.

Parameters
namespaceURI:String

The namespace URI of the node to remove. When it is null or an empty string, this method behaves like removeNamedItem.

name:String

The local name of the node to remove. If the removed attribute is known to have a default value, an attribute immediately appears containing the default value.

Returns:Node

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

Exceptions
DOMException:

Doc from org.w3c.dom.NamedNodeMap.removeNamedItemNS.

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.
NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as [HTML 4.01]).

NOT_FOUND_ERR:
Raised if there is no node named name in the map.
safeRemoveNamedItemback to summary
pack-priv Node safeRemoveNamedItem(String name)

Same as removeNamedItem except that it simply returns null if the specified name is not found.

safeRemoveNamedItemNSback to summary
pack-priv Node safeRemoveNamedItemNS(String namespaceURI, String name)

Same as removeNamedItem except that it simply returns null if the specified local name and namespace URI is not found.

setNamedItemback to summary
public Node setNamedItem(Node arg) throws DOMException

Overrides org.apache.xerces.dom.NamedNodeMapImpl.setNamedItem.

Implements org.w3c.dom.NamedNodeMap.setNamedItem.

Adds an attribute using its nodeName attribute.

Parameters
arg:Node

An Attr node to store in this map.

Returns:Node

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

Exceptions
DOMException:
The exception description.
See Also
org.w3c.dom.NamedNodeMap#setNamedItem
setNamedItemNSback to summary
public Node setNamedItemNS(Node arg) throws DOMException

Overrides org.apache.xerces.dom.NamedNodeMapImpl.setNamedItemNS.

Implements org.w3c.dom.NamedNodeMap.setNamedItemNS.

Adds an attribute using its namespaceURI and localName.

Parameters
arg:Node

A node to store in a named node map.

Returns:Node

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

Exceptions
DOMException:

Doc from org.w3c.dom.NamedNodeMap.setNamedItemNS.

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.
HIERARCHY_REQUEST_ERR: Raised if an attempt is made to add a node doesn't belong in this NamedNodeMap. Examples would include trying to insert something other than an Attr node into an Element's map of attributes, or a non-Entity node into the DocumentType's map of Entities.
NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as [HTML 4.01]).

See Also
org.w3c.dom.NamedNodeMap#setNamedItem