com.caucho.xml
Class QElement

java.lang.Object
  |
  +--com.caucho.xml.QAbstractNode
        |
        +--com.caucho.xml.QNode
              |
              +--com.caucho.xml.QAttributedNode
                    |
                    +--com.caucho.xml.QElement
All Implemented Interfaces:
CauchoElement, CauchoNode, Element, Node, NodeList

public class QElement
extends com.caucho.xml.QAttributedNode
implements CauchoElement

Resin's implementation of the DOM element.


Fields inherited from class com.caucho.xml.QAbstractNode
L
 
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
 
Method Summary
 Node appendChild(Node child)
          Appends a new node as the last child of the element.
 boolean equals(Node arg, boolean deep)
           
 boolean equals(java.lang.Object arg)
           
 java.lang.String getAttribute(java.lang.String name)
          Returns the named attribute.
 Attr getAttributeNode(java.lang.String name)
          Returns the attribute specified by the name.
 Attr getAttributeNodeNS(java.lang.String uri, java.lang.String local)
          Retrieves an Attr node by local name and namespace URI.
 java.lang.String getAttributeNS(java.lang.String namespaceURI, java.lang.String local)
          Returns the attribute specified by a namespace.
 NamedNodeMap getAttributes()
          Returns a map of the attributes.
 java.lang.String getCanonicalName()
          Returns the canonical name of the element.
 NodeList getElementsByTagName(java.lang.String tagName)
          Returns a list of elements, given a tag name.
 NodeList getElementsByTagNameNS(java.lang.String uri, java.lang.String name)
          Returns a list of elements, given a namespace and a local name.
 Attr getFirstAttribute()
          Returns the first attribute in the attribute list.
 java.lang.String getLocalName()
          Returns the local part of the element's name.
 java.lang.String getNamespace(java.lang.String prefix)
          Given a prefix, returns the namespace in effect at this element.
 java.lang.String getNamespaceURI()
          Returns the namespace of the element.
 java.lang.String getNodeName()
          Returns the element's qualified-name as the node name.
 short getNodeType()
          Returns the DOM NodeType, ELEMENT_NODE.
 java.lang.String getPrefix()
          Returns the namespace prefix for the element.
 java.lang.String getTagName()
          Returns the element's qualified-name as the node name.
 java.lang.String getTextValue()
          Returns the text value of the element.
 boolean hasAttribute(java.lang.String name)
          Returns true when an attribute with a given name is specified on this element or has a default value, false otherwise.
 boolean hasAttributeNS(java.lang.String namespaceURI, java.lang.String local)
          Returns true when an attribute with a given local name and namespace URI is specified on this element or has a default value, false otherwise.
 boolean hasAttributes()
          Returns true if the element has attributes.
 boolean hasContent()
           
 void normalize()
          Normalize the element, i.e.
 void removeAttribute(java.lang.String name)
          Removes the named attribute.
 Attr removeAttributeNode(Attr attr)
          Removes the matching attribute.
 Attr removeAttributeNodeNS(Attr attr)
          Removes the matching attribute.
 void removeAttributeNS(java.lang.String uri, java.lang.String name)
          Removes the attribute specified by the localname and namespace.
 void setAttribute(java.lang.String name, java.lang.String value)
          Adds a new attribute.
 Attr setAttributeNode(Attr attr)
          Sets an attribute, specified by the object.
 Attr setAttributeNodeNS(Attr attr)
          Adds a new attribute.
 void setAttributeNS(java.lang.String uri, java.lang.String local, java.lang.String value)
          Adds a new attribute.
 void setName(QName name)
          Assign a name to the element.
 java.lang.String toString()
           
 QAttr unlink(java.lang.String uri, java.lang.String local)
          Removes the attribute named by the URI and local name.
 
Methods inherited from class com.caucho.xml.QNode
checkValid, getChildNodes, getFirstChild, getLastChild, getLength, getNextPreorder, getNextSibling, getNodeValue, getPreviousSibling, hasChildNodes, insertBefore, item, removeChild, replaceChild, setNodeValue
 
Methods inherited from class com.caucho.xml.QAbstractNode
cloneNode, getColumn, getFilename, getLine, getNextContent, getOwnerDocument, getParentNode, getPreviousContent, isSupported, print, printHtml, printPretty, setLocation, setPrefix, supports
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.caucho.xml.CauchoElement
getFirstAttribute
 
Methods inherited from interface org.w3c.dom.Element
getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, hasAttribute, hasAttributeNS, removeAttribute, removeAttributeNode, removeAttributeNS, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS
 
Methods inherited from interface org.w3c.dom.Node
cloneNode, getAttributes, getChildNodes, getFirstChild, getLastChild, getNextSibling, getNodeValue, getOwnerDocument, getParentNode, getPreviousSibling, hasAttributes, hasChildNodes, insertBefore, isSupported, removeChild, replaceChild, setNodeValue, setPrefix
 
Methods inherited from interface com.caucho.xml.CauchoNode
checkValid, getColumn, getFilename, getLine, print, printHtml, printPretty, setLocation
 

Method Detail

setName

public void setName(QName name)
Assign a name to the element. Not normally called by external API.
Parameters:
name - the element's name.

getNodeName

public java.lang.String getNodeName()
Returns the element's qualified-name as the node name.
Specified by:
getNodeName in interface Node

getTagName

public java.lang.String getTagName()
Returns the element's qualified-name as the node name.
Specified by:
getTagName in interface Element

getLocalName

public java.lang.String getLocalName()
Returns the local part of the element's name.
Specified by:
getLocalName in interface Node
Overrides:
getLocalName in class QAbstractNode

getPrefix

public java.lang.String getPrefix()
Returns the namespace prefix for the element.
Specified by:
getPrefix in interface Node
Overrides:
getPrefix in class QAbstractNode
Following copied from interface: org.w3c.dom.Node
Throws:
DOMException - INVALID_CHARACTER_ERR: Raised if the specified prefix contains an illegal character, per the XML 1.0 specification .
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
NAMESPACE_ERR: Raised if the specified prefix is malformed per the Namespaces in XML specification, if the namespaceURI of this node is null, if the specified prefix is "xml" and the namespaceURI of this node is different from "http://www.w3.org/XML/1998/namespace", if this node is an attribute and the specified prefix is "xmlns" and the namespaceURI of this node is different from " http://www.w3.org/2000/xmlns/", or if this node is an attribute and the qualifiedName of this node is "xmlns" .

getCanonicalName

public java.lang.String getCanonicalName()
Returns the canonical name of the element.
Specified by:
getCanonicalName in interface CauchoNode
Overrides:
getCanonicalName in class QAbstractNode

getNamespaceURI

public java.lang.String getNamespaceURI()
Returns the namespace of the element.
Specified by:
getNamespaceURI in interface Node
Overrides:
getNamespaceURI in class QAbstractNode

getNamespace

public java.lang.String getNamespace(java.lang.String prefix)
Given a prefix, returns the namespace in effect at this element.
Specified by:
getNamespace in interface CauchoElement
Parameters:
prefix - the prefix to test.
Returns:
the namespace URL matching the prefix or null.

getNodeType

public short getNodeType()
Returns the DOM NodeType, ELEMENT_NODE.
Specified by:
getNodeType in interface Node

getElementsByTagName

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

getElementsByTagNameNS

public NodeList getElementsByTagNameNS(java.lang.String uri,
                                       java.lang.String name)
Returns a list of elements, given a namespace and a local name.
Specified by:
getElementsByTagNameNS in interface Element
Following copied from interface: org.w3c.dom.Element
Parameters:
namespaceURI - The namespace URI of the elements to match on. The special value "*" matches all namespaces.
localName - The 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.

appendChild

public Node appendChild(Node child)
                 throws DOMException
Appends a new node as the last child of the element.
Specified by:
appendChild in interface Node
Overrides:
appendChild in class QNode
Parameters:
child - the new child.
Returns:
the child.

normalize

public void normalize()
Normalize the element, i.e. smash all neighboring text nodes together.
Specified by:
normalize in interface Node
Overrides:
normalize in class QNode

hasContent

public boolean hasContent()
Overrides:
hasContent in class QAbstractNode

equals

public boolean equals(java.lang.Object arg)
Overrides:
equals in class QNode

equals

public boolean equals(Node arg,
                      boolean deep)
Overrides:
equals in class QNode

getTextValue

public java.lang.String getTextValue()
Returns the text value of the element. For an element, the text value is the smashing together of all the child text nodes.
Specified by:
getTextValue in interface CauchoNode
Overrides:
getTextValue in class QAbstractNode

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getAttributes

public NamedNodeMap getAttributes()
Returns a map of the attributes.
Overrides:
getAttributes in class QNode

hasAttributes

public boolean hasAttributes()
Returns true if the element has attributes.
Overrides:
hasAttributes in class QAbstractNode
Following copied from interface: org.w3c.dom.Node
Returns:
true if this node has any attributes, false otherwise.

getFirstAttribute

public Attr getFirstAttribute()
Returns the first attribute in the attribute list.

getAttribute

public java.lang.String getAttribute(java.lang.String name)
Returns the named attribute.

getAttributeNS

public java.lang.String getAttributeNS(java.lang.String namespaceURI,
                                       java.lang.String local)
Returns the attribute specified by a namespace.

hasAttribute

public boolean hasAttribute(java.lang.String name)

hasAttributeNS

public boolean hasAttributeNS(java.lang.String namespaceURI,
                              java.lang.String local)

getAttributeNode

public Attr getAttributeNode(java.lang.String name)
Returns the attribute specified by the name.

getAttributeNodeNS

public Attr getAttributeNodeNS(java.lang.String uri,
                               java.lang.String local)

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.String value)
                  throws DOMException

setAttributeNS

public void setAttributeNS(java.lang.String uri,
                           java.lang.String local,
                           java.lang.String value)

setAttributeNode

public Attr setAttributeNode(Attr attr)
                      throws DOMException
Sets an attribute, specified by the object.

setAttributeNodeNS

public Attr setAttributeNodeNS(Attr attr)
                        throws DOMException

removeAttribute

public void removeAttribute(java.lang.String name)
Removes the named attribute.

removeAttributeNS

public void removeAttributeNS(java.lang.String uri,
                              java.lang.String name)
Removes the attribute specified by the localname and namespace.

removeAttributeNode

public Attr removeAttributeNode(Attr attr)
Removes the matching attribute.

removeAttributeNodeNS

public Attr removeAttributeNodeNS(Attr attr)
Removes the matching attribute.

unlink

public QAttr unlink(java.lang.String uri,
                    java.lang.String local)
Removes the attribute named by the URI and local name.