Class AttributeMap
- java.lang.Object
-
- org.htmlunit.cyberneko.xerces.dom.NamedNodeMapImpl
-
- org.htmlunit.cyberneko.xerces.dom.AttributeMap
-
- All Implemented Interfaces:
org.w3c.dom.NamedNodeMap
public class AttributeMap extends NamedNodeMapImpl
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.
-
-
Field Summary
-
Fields inherited from class org.htmlunit.cyberneko.xerces.dom.NamedNodeMapImpl
CHANGED, flags, HASDEFAULTS, nodes, ownerNode, READONLY
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAttributeMap(ElementImpl ownerNode)Constructs a named node map.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected intaddItem(org.w3c.dom.Node arg)protected voidcloneContent(NamedNodeMapImpl srcmap)Override parent's method to set the ownerNode correctlyNamedNodeMapImplcloneMap(NodeImpl ownerNode)Cloning a NamedNodeMap is a DEEP OPERATION; it always clones all the nodes contained in the map.protected org.w3c.dom.NodeinternalRemoveNamedItem(java.lang.String name, boolean raiseEx)Internal removeNamedItem method allowing to specify whether an exception must be thrown if the specified name is not found.protected org.w3c.dom.NodeinternalRemoveNamedItemNS(java.lang.String namespaceURI, java.lang.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.(package private) voidmoveSpecifiedAttributes(AttributeMap srcmap)Move specified attributes from the given map to this oneprivate org.w3c.dom.Noderemove(AttrImpl attr, int index)protected org.w3c.dom.NoderemoveItem(org.w3c.dom.Node item)NON-DOM: Remove the node objectorg.w3c.dom.NoderemoveNamedItem(java.lang.String name)Removes an attribute specified by name.org.w3c.dom.NoderemoveNamedItemNS(java.lang.String namespaceURI, java.lang.String name)Introduced in DOM Level 2.org.w3c.dom.NodesetNamedItem(org.w3c.dom.Node arg)Adds an attribute using its nodeName attribute.org.w3c.dom.NodesetNamedItemNS(org.w3c.dom.Node arg)Adds an attribute using its namespaceURI and localName.-
Methods inherited from class org.htmlunit.cyberneko.xerces.dom.NamedNodeMapImpl
changed, changed, findNamePoint, findNamePoint, getItem, getLength, getNamedItem, getNamedItemIndex, getNamedItemNS, hasDefaults, hasDefaults, item, precedes, removeAll, removeItem, setOwnerDocument
-
-
-
-
Constructor Detail
-
AttributeMap
protected AttributeMap(ElementImpl ownerNode)
Constructs a named node map.- Parameters:
ownerNode- the owner node
-
-
Method Detail
-
setNamedItem
public org.w3c.dom.Node setNamedItem(org.w3c.dom.Node arg) throws org.w3c.dom.DOMExceptionAdds an attribute using its nodeName attribute.- Specified by:
setNamedItemin interfaceorg.w3c.dom.NamedNodeMap- Overrides:
setNamedItemin 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:
org.w3c.dom.DOMException- The exception description.- See Also:
NamedNodeMap.setNamedItem(org.w3c.dom.Node)
-
setNamedItemNS
public org.w3c.dom.Node setNamedItemNS(org.w3c.dom.Node arg) throws org.w3c.dom.DOMExceptionAdds an attribute using its namespaceURI and localName.- Specified by:
setNamedItemNSin interfaceorg.w3c.dom.NamedNodeMap- Overrides:
setNamedItemNSin 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:
org.w3c.dom.DOMException- See Also:
NamedNodeMap.setNamedItem(org.w3c.dom.Node)
-
removeNamedItem
public org.w3c.dom.Node removeNamedItem(java.lang.String name) throws org.w3c.dom.DOMExceptionRemoves an attribute specified by name.- Specified by:
removeNamedItemin interfaceorg.w3c.dom.NamedNodeMap- Overrides:
removeNamedItemin classNamedNodeMapImpl- Parameters:
name- The name of a node to remove. 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.- Returns:
- The node removed from the map if a node with such a name exists.
- Throws:
org.w3c.dom.DOMException- NOT_FOUND_ERR: Raised if there is no node named name in the map.
-
removeItem
protected org.w3c.dom.Node removeItem(org.w3c.dom.Node item) throws org.w3c.dom.DOMExceptionNON-DOM: Remove the node objectNOTE: 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 remove- Returns:
- Removed node
- Throws:
org.w3c.dom.DOMException- on error
-
internalRemoveNamedItem
protected final org.w3c.dom.Node internalRemoveNamedItem(java.lang.String name, boolean raiseEx)Internal removeNamedItem method allowing to specify whether an exception must be thrown if the specified name is not found.- Parameters:
name- the maneraiseEx- if true raise an exception- Returns:
- the node
-
remove
private org.w3c.dom.Node remove(AttrImpl attr, int index)
-
removeNamedItemNS
public org.w3c.dom.Node removeNamedItemNS(java.lang.String namespaceURI, java.lang.String name) throws org.w3c.dom.DOMExceptionIntroduced in DOM Level 2.Removes an attribute specified by local name and namespace URI.
- Specified by:
removeNamedItemNSin interfaceorg.w3c.dom.NamedNodeMap- Overrides:
removeNamedItemNSin 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:
org.w3c.dom.DOMException- NOT_FOUND_ERR: Raised if there is no node named name in the map.
-
internalRemoveNamedItemNS
protected final org.w3c.dom.Node internalRemoveNamedItemNS(java.lang.String namespaceURI, java.lang.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.- Parameters:
namespaceURI- the namespace uriname- the nameraiseEx- if true raise exception- Returns:
- the node
-
cloneMap
public NamedNodeMapImpl cloneMap(NodeImpl ownerNode)
Cloning a NamedNodeMap is a DEEP OPERATION; it always clones all the nodes contained in the map.- Overrides:
cloneMapin classNamedNodeMapImpl- Parameters:
ownerNode- the owner node- Returns:
- the cloned map
-
cloneContent
protected void cloneContent(NamedNodeMapImpl srcmap)
Override parent's method to set the ownerNode correctly- Overrides:
cloneContentin classNamedNodeMapImpl- Parameters:
srcmap- the source map
-
moveSpecifiedAttributes
void moveSpecifiedAttributes(AttributeMap srcmap)
Move specified attributes from the given map to this one- Parameters:
srcmap- the source map
-
addItem
protected final int addItem(org.w3c.dom.Node arg)
- Overrides:
addItemin classNamedNodeMapImpl
-
-