org.apache.xerces.impl.xs.opti
Class ElementImpl
java.lang.Object
|
+--org.apache.xerces.impl.xs.opti.DefaultNode
|
+--org.apache.xerces.impl.xs.opti.NodeImpl
|
+--org.apache.xerces.impl.xs.opti.DefaultElement
|
+--org.apache.xerces.impl.xs.opti.ElementImpl
- All Implemented Interfaces:
- org.w3c.dom.Element, org.w3c.dom.Node
- public class ElementImpl
- extends DefaultElement
- Version:
- $Id: ElementImpl.java,v 1.5 2003/07/24 15:14:42 neilg Exp $
- Author:
- Rahul Srivastava, Sun Microsystems Inc., Sandy Gao, IBM
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 |
ElementImpl(int line,
int column)
|
ElementImpl(java.lang.String prefix,
java.lang.String localpart,
java.lang.String rawname,
java.lang.String uri,
int line,
int column)
|
Method Summary |
java.lang.String |
getAttribute(java.lang.String name)
Retrieves an attribute value by name. |
org.w3c.dom.Attr |
getAttributeNode(java.lang.String name)
Retrieves an attribute node by name. |
org.w3c.dom.Attr |
getAttributeNodeNS(java.lang.String namespaceURI,
java.lang.String localName)
Retrieves an Attr node by local name and namespace URI. |
java.lang.String |
getAttributeNS(java.lang.String namespaceURI,
java.lang.String localName)
Retrieves an attribute value by local name and namespace URI. |
org.w3c.dom.NamedNodeMap |
getAttributes()
|
int |
getColumnNumber()
Returns the column number. |
org.w3c.dom.Node |
getFirstChild()
|
org.w3c.dom.Node |
getLastChild()
|
int |
getLineNumber()
Returns the line number. |
org.w3c.dom.Node |
getNextSibling()
|
org.w3c.dom.Document |
getOwnerDocument()
|
org.w3c.dom.Node |
getParentNode()
|
org.w3c.dom.Node |
getPreviousSibling()
|
java.lang.String |
getTagName()
The name 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 localName)
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()
|
boolean |
hasChildNodes()
|
void |
setAttribute(java.lang.String name,
java.lang.String value)
Adds a new attribute. |
Methods inherited from class org.apache.xerces.impl.xs.opti.DefaultElement |
getElementsByTagName, getElementsByTagNameNS, getSchemaTypeInfo, removeAttribute, removeAttributeNode, removeAttributeNS, setAttributeNode, setAttributeNodeNS, setAttributeNS, setIdAttribute, setIdAttributeNode, setIdAttributeNS |
Methods inherited from class org.apache.xerces.impl.xs.opti.DefaultNode |
appendChild, cloneNode, compareDocumentPosition, getBaseURI, getChildNodes, getFeature, getNodeValue, getTextContent, getUserData, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData |
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, getLocalName, getNamespaceURI, getNodeName, getNodeType, getNodeValue, getPrefix, insertBefore, isSupported, normalize, removeChild, replaceChild, setNodeValue, setPrefix |
ElementImpl
public ElementImpl(int line,
int column)
ElementImpl
public ElementImpl(java.lang.String prefix,
java.lang.String localpart,
java.lang.String rawname,
java.lang.String uri,
int line,
int column)
getOwnerDocument
public org.w3c.dom.Document getOwnerDocument()
- Overrides:
getOwnerDocument
in class DefaultNode
getParentNode
public org.w3c.dom.Node getParentNode()
- Overrides:
getParentNode
in class DefaultNode
hasChildNodes
public boolean hasChildNodes()
- Overrides:
hasChildNodes
in class DefaultNode
getFirstChild
public org.w3c.dom.Node getFirstChild()
- Overrides:
getFirstChild
in class DefaultNode
getLastChild
public org.w3c.dom.Node getLastChild()
- Overrides:
getLastChild
in class DefaultNode
getPreviousSibling
public org.w3c.dom.Node getPreviousSibling()
- Overrides:
getPreviousSibling
in class DefaultNode
getNextSibling
public org.w3c.dom.Node getNextSibling()
- Overrides:
getNextSibling
in class DefaultNode
getAttributes
public org.w3c.dom.NamedNodeMap getAttributes()
- Overrides:
getAttributes
in class DefaultNode
hasAttributes
public boolean hasAttributes()
- Overrides:
hasAttributes
in class DefaultNode
getTagName
public java.lang.String getTagName()
- Description copied from interface:
org.w3c.dom.Element
- The name of the element. For example, in:
<elementExample
id="demo"> ... </elementExample> ,
tagName
has
the value "elementExample"
. Note that this is
case-preserving in XML, as are all of the operations of the DOM. The
HTML DOM returns the tagName
of an HTML element in the
canonical uppercase form, regardless of the case in the source HTML
document.
- Overrides:
getTagName
in class DefaultElement
getAttribute
public java.lang.String getAttribute(java.lang.String name)
- Description copied from interface:
org.w3c.dom.Element
- Retrieves an attribute value by name.
- Overrides:
getAttribute
in class DefaultElement
- Following copied from interface:
org.w3c.dom.Element
- Parameters:
name
- The 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.
getAttributeNode
public org.w3c.dom.Attr getAttributeNode(java.lang.String name)
- Description copied from interface:
org.w3c.dom.Element
- Retrieves an attribute node by name.
To retrieve an attribute node by qualified name and namespace URI,
use the getAttributeNodeNS
method.
- Overrides:
getAttributeNode
in class DefaultElement
- Following copied from interface:
org.w3c.dom.Element
- Parameters:
name
- The name (nodeName
) of the attribute to
retrieve.- Returns:
- The
Attr
node with the specified name (
nodeName
) or null
if there is no such
attribute.
getAttributeNS
public java.lang.String getAttributeNS(java.lang.String namespaceURI,
java.lang.String localName)
- Description copied from interface:
org.w3c.dom.Element
- Retrieves an attribute value by local name and namespace URI.
Documents which do not support the "XML" feature will permit only
the DOM Level 1 calls for creating/setting elements and attributes.
Hence, if you specify a non-null namespace URI, these DOMs will never
find a matching node.
- Overrides:
getAttributeNS
in class DefaultElement
- Following copied from interface:
org.w3c.dom.Element
- Parameters:
namespaceURI
- The namespace URI of the attribute to retrieve.localName
- The 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.
getAttributeNodeNS
public org.w3c.dom.Attr getAttributeNodeNS(java.lang.String namespaceURI,
java.lang.String localName)
- Description copied from interface:
org.w3c.dom.Element
- Retrieves an
Attr
node by local name and namespace URI.
Documents which do not support the "XML" feature will permit only
the DOM Level 1 calls for creating/setting elements and attributes.
Hence, if you specify a non-null namespace URI, these DOMs will never
find a matching node.
- Overrides:
getAttributeNodeNS
in class DefaultElement
- Following copied from interface:
org.w3c.dom.Element
- Parameters:
namespaceURI
- The namespace URI of the attribute to retrieve.localName
- The 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.
hasAttribute
public boolean hasAttribute(java.lang.String name)
- Description copied from interface:
org.w3c.dom.Element
- Returns
true
when an attribute with a given name is
specified on this element or has a default value, false
otherwise.
- Overrides:
hasAttribute
in class DefaultElement
- Following copied from interface:
org.w3c.dom.Element
- Parameters:
name
- The 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.
hasAttributeNS
public boolean hasAttributeNS(java.lang.String namespaceURI,
java.lang.String localName)
- Description copied from interface:
org.w3c.dom.Element
- 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.
Documents which do not support the "XML" feature will permit only
the DOM Level 1 calls for creating/setting elements and attributes.
Hence, if you specify a non-null namespace URI, these DOMs will never
find a matching node.
- Overrides:
hasAttributeNS
in class DefaultElement
- Following copied from interface:
org.w3c.dom.Element
- Parameters:
namespaceURI
- The namespace URI of the attribute to look for.localName
- The 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.
setAttribute
public void setAttribute(java.lang.String name,
java.lang.String value)
- Description copied from interface:
org.w3c.dom.Element
- Adds a new attribute. If an attribute with that name is already present
in the element, its value is changed to be that of the value
parameter. This value is a simple string; it is not parsed as it is
being set. So any markup (such as syntax to be recognized as an
entity reference) is treated as literal text, and needs to be
appropriately escaped by the implementation when it is written out.
In order to assign an attribute value that contains entity
references, the user must create an
Attr
node plus any
Text
and EntityReference
nodes, build the
appropriate subtree, and use setAttributeNode
to assign
it as the value of an attribute.
To set an attribute with a qualified name and namespace URI, use
the setAttributeNS
method.
- Overrides:
setAttribute
in class DefaultElement
- Following copied from interface:
org.w3c.dom.Element
- Parameters:
name
- The name of the attribute to create or alter.value
- Value to set in string form.- Throws:
org.w3c.dom.DOMException
- INVALID_CHARACTER_ERR: Raised if the specified name contains an
illegal character.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
getLineNumber
public int getLineNumber()
- Returns the line number.
getColumnNumber
public int getColumnNumber()
- Returns the column number.
Copyright © 1999-2004 Apache XML Project. All Rights Reserved.