org.apache.batik.dom
Class AbstractElement

java.lang.Object
  |
  +--org.apache.batik.dom.AbstractNode
        |
        +--org.apache.batik.dom.AbstractParentNode
              |
              +--org.apache.batik.dom.AbstractParentChildNode
                    |
                    +--org.apache.batik.dom.AbstractElement
All Implemented Interfaces:
Element, EventTarget, ExtendedNode, Node, NodeEventTarget, java.io.Serializable
Direct Known Subclasses:
AbstractElementNS, GenericElement, SVGOMElement

public abstract class AbstractElement
extends AbstractParentChildNode
implements Element

This class implements the Element interface.

See Also:
Serialized Form

Inner Class Summary
 class AbstractElement.NamedNodeHashMap
          An implementation of the NamedNodeMap.
 
Inner classes inherited from class org.apache.batik.dom.AbstractParentNode
AbstractParentNode.ChildNodes, AbstractParentNode.Nodes
 
Field Summary
protected  NamedNodeMap attributes
          The attributes of this element.
 
Fields inherited from class org.apache.batik.dom.AbstractParentChildNode
nextSibling, parentNode, previousSibling
 
Fields inherited from class org.apache.batik.dom.AbstractParentNode
childNodes
 
Fields inherited from class org.apache.batik.dom.AbstractNode
EMPTY_NODE_LIST, eventSupport, ownerDocument
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Constructor Summary
protected AbstractElement()
          Creates a new AbstractElement object.
protected AbstractElement(java.lang.String name, AbstractDocument owner)
          Creates a new AbstractElement object.
 
Method Summary
protected  void checkChildType(Node n)
          Checks the validity of a node to be inserted.
protected  Node copyInto(Node n)
          Copy the fields of the current node into the given node.
protected  NamedNodeMap createAttributes()
          Creates the attribute list.
protected  Node deepCopyInto(Node n)
          Deeply copy the fields of the current node into the given node.
protected  Node deepExport(Node n, AbstractDocument d)
          Deeply exports this node to the given document.
protected  Node export(Node n, AbstractDocument d)
          Exports this node to the given document.
 void fireDOMAttrModifiedEvent(java.lang.String name, java.lang.String oldv, java.lang.String newv)
          Fires a DOMAttrModified event.
 java.lang.String getAttribute(java.lang.String name)
          DOM: Implements Element.getAttribute(String).
 Attr getAttributeNode(java.lang.String name)
          DOM: Implements Element.getAttributeNode(String).
 Attr getAttributeNodeNS(java.lang.String namespaceURI, java.lang.String localName)
          DOM: Implements Element.getAttributeNodeNS(String,String).
 java.lang.String getAttributeNS(java.lang.String namespaceURI, java.lang.String localName)
          DOM: Implements Element.getAttributeNS(String,String).
 NamedNodeMap getAttributes()
          DOM: Implements Node.getAttributes().
protected static void getElementsByTagName(Node node, java.lang.String name, AbstractParentNode.Nodes list)
          An auxiliary method of getElementsByTagName.
 NodeList getElementsByTagName(java.lang.String name)
          DOM: Implements Element.getElementsByTagName(String).
protected static void getElementsByTagNameNS(Node node, java.lang.String ns, java.lang.String name, AbstractParentNode.Nodes list)
          An auxiliary method for getElementsByTagNameNS.
 NodeList getElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String localName)
          DOM: Implements Element.getElementsByTagNameNS(String,String).
 short getNodeType()
          DOM: Implements Node.getNodeType().
 java.lang.String getTagName()
          DOM: Implements Element.getTagName().
 boolean hasAttribute(java.lang.String name)
          DOM: Implements Element.hasAttribute(String).
 boolean hasAttributeNS(java.lang.String namespaceURI, java.lang.String localName)
          DOM: Implements Element.hasAttributeNS(String,String).
 boolean hasAttributes()
          DOM: Implements Node.hasAttributes().
 void normalize()
          DOM: Implements Node.normalize().
 void removeAttribute(java.lang.String name)
          DOM: Implements Element.removeAttribute(String).
 Attr removeAttributeNode(Attr oldAttr)
          DOM: Implements Element.removeAttributeNode(Attr).
 void removeAttributeNS(java.lang.String namespaceURI, java.lang.String localName)
          DOM: Implements Element.removeAttributeNS(String,String).
 void setAttribute(java.lang.String name, java.lang.String value)
          DOM: Implements Element.setAttribute(String,String).
 Attr setAttributeNode(Attr newAttr)
          DOM: Implements Element.setAttributeNode(Attr).
 Attr setAttributeNodeNS(Attr newAttr)
          DOM: Implements Element.setAttributeNodeNS(Attr).
 void setAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName, java.lang.String value)
          DOM: Implements Element.setAttributeNS(String,String,String).
 
Methods inherited from class org.apache.batik.dom.AbstractParentChildNode
getNextSibling, getParentNode, getPreviousSibling, setNextSibling, setParentNode, setPreviousSibling
 
Methods inherited from class org.apache.batik.dom.AbstractParentNode
appendChild, checkAndRemove, fireDOMNodeInsertedEvent, fireDOMNodeInsertedIntoDocumentEvent, fireDOMNodeRemovedEvent, fireDOMNodeRemovedFromDocumentEvent, fireDOMSubtreeModifiedEvent, getChildNodes, getFirstChild, getLastChild, hasChildNodes, insertBefore, removeChild, replaceChild
 
Methods inherited from class org.apache.batik.dom.AbstractNode
addEventListener, cloneNode, createDOMException, dispatchEvent, fireDOMCharacterDataModifiedEvent, getCurrentDocument, getEventSupport, getLocalName, getNamespaceURI, getNodeValue, getOwnerDocument, getParentNodeEventTarget, getPrefix, isSupported, removeEventListener, setNodeName, setNodeValue, setOwnerDocument, setPrefix, setSpecified
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, hasChildNodes, insertBefore, isSupported, removeChild, replaceChild, setNodeValue, setPrefix
 
Methods inherited from interface org.apache.batik.dom.ExtendedNode
isReadonly, setReadonly
 

Field Detail

attributes

protected NamedNodeMap attributes
The attributes of this element.
Constructor Detail

AbstractElement

protected AbstractElement()
Creates a new AbstractElement object.

AbstractElement

protected AbstractElement(java.lang.String name,
                          AbstractDocument owner)
Creates a new AbstractElement object.
Parameters:
name - The element name for validation purposes.
owner - The owner document.
Throws:
DOMException - INVALID_CHARACTER_ERR: if name contains invalid characters,
Method Detail

getNodeType

public short getNodeType()
DOM: Implements Node.getNodeType().
Specified by:
getNodeType in interface Node
Returns:
Node.ELEMENT_NODE

hasAttributes

public boolean hasAttributes()
DOM: Implements Node.hasAttributes().
Specified by:
hasAttributes in interface Node
Overrides:
hasAttributes in class AbstractNode
Returns:
true.

getAttributes

public NamedNodeMap getAttributes()
DOM: Implements Node.getAttributes().
Specified by:
getAttributes in interface Node
Overrides:
getAttributes in class AbstractNode
Returns:
attributes.

getTagName

public java.lang.String getTagName()
DOM: Implements Element.getTagName().
Specified by:
getTagName in interface Element
Returns:
Node.getNodeName().

hasAttribute

public boolean hasAttribute(java.lang.String name)
DOM: Implements Element.hasAttribute(String).
Specified by:
hasAttribute in interface Element
Following copied from interface: org.w3c.dom.Element
Parameters:
nameThe - name of the attribute to look for.
Returns:
true if an attribute with the given name is specified on this element or has a default value, false otherwise.

getAttribute

public java.lang.String getAttribute(java.lang.String name)
DOM: Implements Element.getAttribute(String).
Specified by:
getAttribute in interface Element
Following copied from interface: org.w3c.dom.Element
Parameters:
nameThe - name of the attribute to retrieve.
Returns:
The Attr value as a string, or the empty string if that attribute does not have a specified or default value.

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.String value)
                  throws DOMException
DOM: Implements Element.setAttribute(String,String).
Specified by:
setAttribute in interface Element
Following copied from interface: org.w3c.dom.Element
Parameters:
nameThe - name of the attribute to create or alter.
valueValue - to set in string form.
Throws:
DOMException - INVALID_CHARACTER_ERR: Raised if the specified name contains an illegal character.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

removeAttribute

public void removeAttribute(java.lang.String name)
                     throws DOMException
DOM: Implements Element.removeAttribute(String).
Specified by:
removeAttribute in interface Element
Following copied from interface: org.w3c.dom.Element
Parameters:
nameThe - name of the attribute to remove.
Throws:
DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

getAttributeNode

public Attr getAttributeNode(java.lang.String name)
DOM: Implements Element.getAttributeNode(String).
Specified by:
getAttributeNode in interface Element
Following copied from interface: org.w3c.dom.Element
Parameters:
nameThe - name (nodeName) of the attribute to retrieve.
Returns:
The Attr node with the specified name ( nodeName) or null if there is no such attribute.

setAttributeNode

public Attr setAttributeNode(Attr newAttr)
                      throws DOMException
DOM: Implements Element.setAttributeNode(Attr).
Specified by:
setAttributeNode in interface Element
Following copied from interface: org.w3c.dom.Element
Parameters:
newAttrThe - Attr node to add to the attribute list.
Returns:
If the newAttr attribute replaces an existing attribute, the replaced Attr node is returned, otherwise null is returned.
Throws:
DOMException - WRONG_DOCUMENT_ERR: Raised if newAttr was created from a different document than the one that created the element.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
INUSE_ATTRIBUTE_ERR: Raised if newAttr is already an attribute of another Element object. The DOM user must explicitly clone Attr nodes to re-use them in other elements.

removeAttributeNode

public Attr removeAttributeNode(Attr oldAttr)
                         throws DOMException
DOM: Implements Element.removeAttributeNode(Attr).
Specified by:
removeAttributeNode in interface Element
Following copied from interface: org.w3c.dom.Element
Parameters:
oldAttrThe - Attr node to remove from the attribute list.
Returns:
The Attr node that was removed.
Throws:
DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
NOT_FOUND_ERR: Raised if oldAttr is not an attribute of the element.

getElementsByTagName

public NodeList getElementsByTagName(java.lang.String name)
DOM: Implements Element.getElementsByTagName(String).
Specified by:
getElementsByTagName in interface Element
Following copied from interface: org.w3c.dom.Element
Parameters:
nameThe - name of the tag to match on. The special value "*" matches all tags.
Returns:
A list of matching Element nodes.

normalize

public void normalize()
DOM: Implements Node.normalize().
Specified by:
normalize in interface Node
Overrides:
normalize in class AbstractParentNode

hasAttributeNS

public boolean hasAttributeNS(java.lang.String namespaceURI,
                              java.lang.String localName)
DOM: Implements Element.hasAttributeNS(String,String).
Specified by:
hasAttributeNS in interface Element
Following copied from interface: org.w3c.dom.Element
Parameters:
namespaceURIThe - namespace URI of the attribute to look for.
localNameThe - local name of the attribute to look for.
Returns:
true if an attribute with the given local name and namespace URI is specified or has a default value on this element, false otherwise.

getAttributeNS

public java.lang.String getAttributeNS(java.lang.String namespaceURI,
                                       java.lang.String localName)
DOM: Implements Element.getAttributeNS(String,String).
Specified by:
getAttributeNS in interface Element
Following copied from interface: org.w3c.dom.Element
Parameters:
namespaceURIThe - namespace URI of the attribute to retrieve.
localNameThe - local name of the attribute to retrieve.
Returns:
The Attr value as a string, or the empty string if that attribute does not have a specified or default value.

setAttributeNS

public void setAttributeNS(java.lang.String namespaceURI,
                           java.lang.String qualifiedName,
                           java.lang.String value)
                    throws DOMException
DOM: Implements Element.setAttributeNS(String,String,String).
Specified by:
setAttributeNS in interface Element
Following copied from interface: org.w3c.dom.Element
Parameters:
namespaceURIThe - namespace URI of the attribute to create or alter.
qualifiedNameThe - qualified name of the attribute to create or alter.
valueThe - value to set in string form.
Throws:
DOMException - INVALID_CHARACTER_ERR: Raised if the specified qualified name contains an illegal character.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
NAMESPACE_ERR: Raised if the qualifiedName is malformed, if the qualifiedName has a prefix and the namespaceURI is null, if the qualifiedName has a prefix that is "xml" and the namespaceURI is different from " http://www.w3.org/XML/1998/namespace", or if the qualifiedName is "xmlns" and the namespaceURI is different from " http://www.w3.org/2000/xmlns/".

removeAttributeNS

public void removeAttributeNS(java.lang.String namespaceURI,
                              java.lang.String localName)
                       throws DOMException
DOM: Implements Element.removeAttributeNS(String,String).
Specified by:
removeAttributeNS in interface Element
Following copied from interface: org.w3c.dom.Element
Parameters:
namespaceURIThe - namespace URI of the attribute to remove.
localNameThe - local name of the attribute to remove.
Throws:
DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

getAttributeNodeNS

public Attr getAttributeNodeNS(java.lang.String namespaceURI,
                               java.lang.String localName)
DOM: Implements Element.getAttributeNodeNS(String,String).
Specified by:
getAttributeNodeNS in interface Element
Following copied from interface: org.w3c.dom.Element
Parameters:
namespaceURIThe - namespace URI of the attribute to retrieve.
localNameThe - local name of the attribute to retrieve.
Returns:
The Attr node with the specified attribute local name and namespace URI or null if there is no such attribute.

setAttributeNodeNS

public Attr setAttributeNodeNS(Attr newAttr)
                        throws DOMException
DOM: Implements Element.setAttributeNodeNS(Attr).
Specified by:
setAttributeNodeNS in interface Element
Following copied from interface: org.w3c.dom.Element
Parameters:
newAttrThe - Attr node to add to the attribute list.
Returns:
If the newAttr attribute replaces an existing attribute with the same local name and namespace URI, the replaced Attr node is returned, otherwise null is returned.
Throws:
DOMException - WRONG_DOCUMENT_ERR: Raised if newAttr was created from a different document than the one that created the element.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
INUSE_ATTRIBUTE_ERR: Raised if newAttr is already an attribute of another Element object. The DOM user must explicitly clone Attr nodes to re-use them in other elements.

getElementsByTagNameNS

public NodeList getElementsByTagNameNS(java.lang.String namespaceURI,
                                       java.lang.String localName)
DOM: Implements Element.getElementsByTagNameNS(String,String).
Specified by:
getElementsByTagNameNS in interface Element
Following copied from interface: org.w3c.dom.Element
Parameters:
namespaceURIThe - namespace URI of the elements to match on. The special value "*" matches all namespaces.
localNameThe - local name of the elements to match on. The special value "*" matches all local names.
Returns:
A new NodeList object containing all the matched Elements.

createAttributes

protected NamedNodeMap createAttributes()
Creates the attribute list.

getElementsByTagName

protected static void getElementsByTagName(Node node,
                                           java.lang.String name,
                                           AbstractParentNode.Nodes list)
An auxiliary method of getElementsByTagName.

getElementsByTagNameNS

protected static void getElementsByTagNameNS(Node node,
                                             java.lang.String ns,
                                             java.lang.String name,
                                             AbstractParentNode.Nodes list)
An auxiliary method for getElementsByTagNameNS.

export

protected Node export(Node n,
                      AbstractDocument d)
Exports this node to the given document.
Overrides:
export in class AbstractNode
Parameters:
n - The clone node.
d - The destination document.

deepExport

protected Node deepExport(Node n,
                          AbstractDocument d)
Deeply exports this node to the given document.
Overrides:
deepExport in class AbstractParentNode
Parameters:
n - The clone node.
d - The destination document.

copyInto

protected Node copyInto(Node n)
Copy the fields of the current node into the given node.
Overrides:
copyInto in class AbstractNode
Parameters:
n - a node of the type of this.

deepCopyInto

protected Node deepCopyInto(Node n)
Deeply copy the fields of the current node into the given node.
Overrides:
deepCopyInto in class AbstractParentNode
Parameters:
n - a node of the type of this.

checkChildType

protected void checkChildType(Node n)
Checks the validity of a node to be inserted.
Overrides:
checkChildType in class AbstractNode
Parameters:
n - The node to be inserted.

fireDOMAttrModifiedEvent

public void fireDOMAttrModifiedEvent(java.lang.String name,
                                     java.lang.String oldv,
                                     java.lang.String newv)
Fires a DOMAttrModified event. WARNING: public accessor because of compilation problems on Solaris. Do not change.
Parameters:
name - The attribute name.
oldv - The old value of the attribute.
newv - The new value of the attribute.


Copyright © 2000 Apache Software Foundation. All Rights Reserved.