Package org.apache.xerces.dom
Class AttributeMap
java.lang.Object
org.apache.xerces.dom.NamedNodeMapImpl
org.apache.xerces.dom.AttributeMap
- All Implemented Interfaces:
Serializable
,NamedNodeMap
AttributeMap inherits from NamedNodeMapImpl and extends it to deal with the
specifics of storing attributes. These are:
- managing ownership of attribute nodes
- managing default attributes
- firing mutation events
This class doesn't directly support mutation events, however, it notifies the document when mutations are performed so that the document class do so.
INTERNAL:
- Usage of this class is not supported. It may be altered or removed at any time.
- Version:
- $Id: AttributeMap.java 612590 2008-01-16 22:16:09Z mrglavas $
- See Also:
-
Field Summary
Fields inherited from class org.apache.xerces.dom.NamedNodeMapImpl
CHANGED, flags, HASDEFAULTS, nodes, ownerNode, READONLY
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AttributeMap
(ElementImpl ownerNode, NamedNodeMapImpl defaults) Constructs a named node map. -
Method Summary
Modifier and TypeMethodDescriptionprotected final int
protected void
cloneContent
(NamedNodeMapImpl srcmap) Override parent's method to set the ownerNode correctlyCloning 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.protected void
reconcileDefaults
(NamedNodeMapImpl defaults) Get this AttributeMap in sync with the given "defaults" map.protected Node
removeItem
(Node item, boolean addDefault) NON-DOM: Remove the node object NOTE: Specifically removes THIS NODE -- not the node with this name, nor the node with these contents.removeNamedItem
(String name) removeNamedItemNS
(String namespaceURI, String name) Introduced in DOM Level 2.setNamedItem
(Node arg) Adds an attribute using its nodeName attribute.setNamedItemNS
(Node arg) Adds an attribute using its namespaceURI and localName.Methods inherited from class org.apache.xerces.dom.NamedNodeMapImpl
cloneMap, findNamePoint, findNamePoint, getItem, getLength, getNamedItem, getNamedItemIndex, getNamedItemNS, item, precedes, removeAll, removeItem, setOwnerDocument
-
Constructor Details
-
AttributeMap
Constructs a named node map.
-
-
Method Details
-
setNamedItem
Adds an attribute using its nodeName attribute.- Specified by:
setNamedItem
in interfaceNamedNodeMap
- Overrides:
setNamedItem
in classNamedNodeMapImpl
- Parameters:
arg
- An Attr node to store in this map.- Returns:
- If the new Node replaces an existing node the replaced Node is returned, otherwise null is returned.
- Throws:
DOMException
- The exception description.- See Also:
-
setNamedItemNS
Adds an attribute using its namespaceURI and localName.- Specified by:
setNamedItemNS
in interfaceNamedNodeMap
- Overrides:
setNamedItemNS
in classNamedNodeMapImpl
- Parameters:
arg
- A node to store in a named node map.- Returns:
- If the new Node replaces an existing node the replaced Node is returned, otherwise null is returned.
- Throws:
DOMException
- See Also:
-
removeNamedItem
- Specified by:
removeNamedItem
in interfaceNamedNodeMap
- Overrides:
removeNamedItem
in classNamedNodeMapImpl
- Throws:
DOMException
-
removeItem
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
- The node to removeaddDefault
- true -- magically add default attribute- Returns:
- Removed node
- Throws:
DOMException
-
internalRemoveNamedItem
Internal removeNamedItem method allowing to specify whether an exception must be thrown if the specified name is not found. -
removeNamedItemNS
Introduced in DOM Level 2.Removes an attribute specified by local name and namespace URI.
- Specified by:
removeNamedItemNS
in interfaceNamedNodeMap
- Overrides:
removeNamedItemNS
in classNamedNodeMapImpl
- Parameters:
namespaceURI
- The namespace URI of the node to remove. When it is null or an empty string, this method behaves like removeNamedItem.name
- 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 The node removed from the map if a node with such a local name and namespace URI exists.
- Throws:
DOMException
-
internalRemoveNamedItemNS
Internal removeNamedItemNS method allowing to specify whether an exception must be thrown if the specified local name and namespace URI is not found. -
cloneMap
Cloning a NamedNodeMap is a DEEP OPERATION; it always clones all the nodes contained in the map.- Overrides:
cloneMap
in classNamedNodeMapImpl
-
cloneContent
Override parent's method to set the ownerNode correctly- Overrides:
cloneContent
in classNamedNodeMapImpl
-
reconcileDefaults
Get this AttributeMap in sync with the given "defaults" map.- Parameters:
defaults
- The default attributes map to sync with.
-
addItem
- Overrides:
addItem
in classNamedNodeMapImpl
-