| java.lang.Object org.apache.xerces.dom.NodeImpl org.apache.xerces.dom.ChildNode org.apache.xerces.dom.ParentNode org.apache.xerces.dom.ElementImpl
All known Subclasses: org.apache.xerces.dom.DeferredElementImpl, org.apache.html.dom.HTMLElementImpl, org.apache.wml.dom.WMLElementImpl, org.apache.xerces.dom.ElementNSImpl,
ElementImpl | public class ElementImpl extends ParentNode implements Element,TypeInfo(Code) | | Elements represent most of the "markup" and structure of the
document. They contain both the data for the element itself
(element name and attributes), and any contained nodes, including
document text (as children).
Elements may have Attributes associated with them; the API for this is
defined in Node, but the function is implemented here. In general, XML
applications should retrive Attributes as Nodes, since they may contain
entity references and hence be a fairly complex sub-tree. HTML users will
be dealing with simple string values, and convenience methods are provided
to work in terms of Strings.
ElementImpl does not support Namespaces. ElementNSImpl, which inherits from
it, does.
See Also: ElementNSImpl author: Arnaud Le Hors, IBM author: Joe Kesselman, IBM author: Andy Clark, IBM author: Ralf Pfeiffer, IBM version: $Id: ElementImpl.java 449328 2006-09-23 22:58:23Z mrglavas $ since: PR-DOM-Level-1-19980818. |
Method Summary | |
public Node | cloneNode(boolean deep) Return a duplicate copy of this Element. | public String | getAttribute(String name) Look up a single Attribute by name. | public String | getAttributeNS(String namespaceURI, String localName) Introduced in DOM Level 2. | public Attr | getAttributeNode(String name) Look up a single Attribute by name. | public Attr | getAttributeNodeNS(String namespaceURI, String localName) Retrieves an Attr node by local name and namespace URI.
Parameters: namespaceURI - The namespace URI of the attribute toretrieve. Parameters: localName - The local name of the attribute to retrieve. | public NamedNodeMap | getAttributes() Retrieve all the Attributes as a set. | public String | getBaseURI() DOM Level 3 WD - Experimental. | protected NamedNodeMapImpl | getDefaultAttributes() Get the default attributes. | public NodeList | getElementsByTagName(String tagname) Returns a NodeList of all descendent nodes (children,
grandchildren, and so on) which are Elements and which have the
specified tag name.
Note: NodeList is a "live" view of the DOM. | public NodeList | getElementsByTagNameNS(String namespaceURI, String localName) Introduced in DOM Level 2. | public String | getNodeName() | public short | getNodeType() A short integer indicating what type of node this is. | public TypeInfo | getSchemaTypeInfo() Method getSchemaTypeInfo. | public String | getTagName() Returns the name of the Element. | public String | getTypeName() | public String | getTypeNamespace() | protected int | getXercesAttribute(String namespaceURI, String localName) | public boolean | hasAttribute(String name) Introduced in DOM Level 2. | public boolean | hasAttributeNS(String namespaceURI, String localName) Introduced in DOM Level 2. | public boolean | hasAttributes() Introduced in DOM Level 2. | public boolean | isDerivedFrom(String typeNamespaceArg, String typeNameArg, int derivationMethod) Introduced in DOM Level 3. | public boolean | isEqualNode(Node arg) DOM Level 3 WD- Experimental. | void | moveSpecifiedAttributes(ElementImpl el) | public void | normalize() In "normal form" (as read from a source file), there will never be two
Text children in succession. | protected void | reconcileDefaultAttributes() Reconcile default attributes. | public void | removeAttribute(String name) Remove the named attribute from this Element. | public void | removeAttributeNS(String namespaceURI, String localName) Introduced in DOM Level 2. | public Attr | removeAttributeNode(Attr oldAttr) Remove the specified attribute/value pair. | void | rename(String name) | public void | setAttribute(String name, String value) Add a new name/value pair, or replace the value of the existing
attribute having that name. | public void | setAttributeNS(String namespaceURI, String qualifiedName, String value) Introduced in DOM Level 2. | public Attr | setAttributeNode(Attr newAttr) Add a new attribute/value pair, or replace the value of the
existing attribute with that name.
This method allows you to add an Attribute that has already been
constructed, and hence avoids the limitations of the simple
setAttribute() call. | public Attr | setAttributeNodeNS(Attr newAttr) Introduced in DOM Level 2. | public void | setIdAttribute(String name, boolean makeId) | public void | setIdAttributeNS(String namespaceURI, String localName, boolean makeId) | public void | setIdAttributeNode(Attr at, boolean makeId) | protected void | setOwnerDocument(CoreDocumentImpl doc) | public void | setReadOnly(boolean readOnly, boolean deep) NON-DOM: Subclassed to flip the attributes' readonly switch as well. | protected int | setXercesAttributeNode(Attr attr) | protected void | setupDefaultAttributes() Setup the default attributes. | protected void | synchronizeData() Synchronizes the data (name and value) for fast nodes. |
serialVersionUID | final static long serialVersionUID(Code) | | Serialization version.
|
ElementImpl | protected ElementImpl()(Code) | | |
cloneNode | public Node cloneNode(boolean deep)(Code) | | Return a duplicate copy of this Element. Note that its children
will not be copied unless the "deep" flag is true, but Attributes
are always replicated.
See Also: org.w3c.dom.Node.cloneNode(boolean) |
getAttribute | public String getAttribute(String name)(Code) | | Look up a single Attribute by name. Returns the Attribute's
string value, or an empty string (NOT null!) to indicate that the
name did not map to a currently defined attribute.
Note: Attributes may contain complex node trees. This method
returns the "flattened" string obtained from Attribute.getValue().
If you need the structure information, see getAttributeNode().
|
getAttributeNS | public String getAttributeNS(String namespaceURI, String localName)(Code) | | Introduced in DOM Level 2.
Retrieves an attribute value by local name and namespace URI.
Parameters: namespaceURI - The namespace URI of the attribute toretrieve. Parameters: localName - The local name of the attribute to retrieve. String The Attr value as a string, or empty stringif that attributedoes not have a specified or default value. since: WD-DOM-Level-2-19990923 |
getAttributeNode | public Attr getAttributeNode(String name)(Code) | | Look up a single Attribute by name. Returns the Attribute Node,
so its complete child tree is available. This could be important in
XML, where the string rendering may not be sufficient information.
If no matching attribute is available, returns null.
|
getAttributeNodeNS | public Attr getAttributeNodeNS(String namespaceURI, String localName)(Code) | | Retrieves an Attr node by local name and namespace URI.
Parameters: namespaceURI - The namespace URI of the attribute toretrieve. Parameters: localName - The local name of the attribute to retrieve. Attr The Attr node with the specified attributelocal name and namespaceURI or null if there is no such attribute. since: WD-DOM-Level-2-19990923 |
getAttributes | public NamedNodeMap getAttributes()(Code) | | Retrieve all the Attributes as a set. Note that this API is inherited
from Node rather than specified on Element; in fact only Elements will
ever have Attributes, but they want to allow folks to "blindly" operate
on the tree as a set of Nodes.
|
getBaseURI | public String getBaseURI()(Code) | | DOM Level 3 WD - Experimental.
Retrieve baseURI
|
getElementsByTagName | public NodeList getElementsByTagName(String tagname)(Code) | | Returns a NodeList of all descendent nodes (children,
grandchildren, and so on) which are Elements and which have the
specified tag name.
Note: NodeList is a "live" view of the DOM. Its contents will
change as the DOM changes, and alterations made to the NodeList
will be reflected in the DOM.
Parameters: tagname - The type of element to gather. To obtain a list ofall elements no matter what their names, use the wild-card tagname "*". See Also: DeepNodeListImpl |
getElementsByTagNameNS | public NodeList getElementsByTagNameNS(String namespaceURI, String localName)(Code) | | Introduced in DOM Level 2.
Returns a NodeList of all the Elements with a given local name and
namespace URI in the order in which they would be encountered in a
preorder traversal of the Document tree, starting from this node.
Parameters: namespaceURI - The namespace URI of the elements to matchon. The special value "*" matches allnamespaces. When it is null or an emptystring, this method behaves likegetElementsByTagName. Parameters: localName - The local name of the elements to match on.The special value "*" matches all local names. NodeList A new NodeList object containing all the matchedElements. since: WD-DOM-Level-2-19990923 |
getNodeName | public String getNodeName()(Code) | | Returns the element name
|
getNodeType | public short getNodeType()(Code) | | A short integer indicating what type of node this is. The named
constants for this value are defined in the org.w3c.dom.Node interface.
|
getSchemaTypeInfo | public TypeInfo getSchemaTypeInfo()(Code) | | Method getSchemaTypeInfo.
TypeInfo |
getTagName | public String getTagName()(Code) | | Returns the name of the Element. Note that Element.nodeName() is
defined to also return the tag name.
This is case-preserving in XML. HTML should uppercasify it on the
way in.
|
getXercesAttribute | protected int getXercesAttribute(String namespaceURI, String localName)(Code) | | NON-DOM: get inded of an attribute
|
hasAttribute | public boolean hasAttribute(String name)(Code) | | Introduced in DOM Level 2.
|
hasAttributeNS | public boolean hasAttributeNS(String namespaceURI, String localName)(Code) | | Introduced in DOM Level 2.
|
hasAttributes | public boolean hasAttributes()(Code) | | Introduced in DOM Level 2.
|
isDerivedFrom | public boolean isDerivedFrom(String typeNamespaceArg, String typeNameArg, int derivationMethod)(Code) | | Introduced in DOM Level 3.
Checks if a type is derived from another by restriction. See:
http://www.w3.org/TR/DOM-Level-3-Core/core.html#TypeInfo-isDerivedFrom
Parameters: typeNamespaceArg - The namspace of the ancestor type declaration Parameters: typeNameArg - The name of the ancestor type declaration Parameters: derivationMethod - The derivation method boolean True if the type is derived by restriciton for thereference type |
isEqualNode | public boolean isEqualNode(Node arg)(Code) | | DOM Level 3 WD- Experimental.
Override inherited behavior from NodeImpl and ParentNode to check on
attributes
|
normalize | public void normalize()(Code) | | In "normal form" (as read from a source file), there will never be two
Text children in succession. But DOM users may create successive Text
nodes in the course of manipulating the document. Normalize walks the
sub-tree and merges adjacent Texts, as if the DOM had been written out
and read back in again. This simplifies implementation of higher-level
functions that may want to assume that the document is in standard form.
To normalize a Document, normalize its top-level Element child.
As of PR-DOM-Level-1-19980818, CDATA -- despite being a subclass of
Text -- is considered "markup" and will _not_ be merged either with
normal Text or with other CDATASections.
|
reconcileDefaultAttributes | protected void reconcileDefaultAttributes()(Code) | | Reconcile default attributes.
|
removeAttribute | public void removeAttribute(String name)(Code) | | Remove the named attribute from this Element. If the removed
Attribute has a default value, it is immediately replaced thereby.
The default logic is actually implemented in NamedNodeMapImpl.
PR-DOM-Level-1-19980818 doesn't fully address the DTD, so some
of this behavior is likely to change in future versions. ?????
Note that this call "succeeds" even if no attribute by this name
existed -- unlike removeAttributeNode, which will throw a not-found
exception in that case.
throws: DOMException - (NO_MODIFICATION_ALLOWED_ERR) if the node isreadonly. |
removeAttributeNS | public void removeAttributeNS(String namespaceURI, String localName)(Code) | | Introduced in DOM Level 2.
Removes an attribute by local name and namespace URI. If the removed
attribute has a default value it is immediately replaced.
The replacing attribute has the same namespace URI and local name,
as well as the original prefix.
Parameters: namespaceURI - The namespace URI of the attribute to remove. Parameters: localName - The local name of the attribute to remove. throws: NO_MODIFICATION_ALLOWED_ERR - : Raised if thisnode is readonly. since: WD-DOM-Level-2-19990923 |
removeAttributeNode | public Attr removeAttributeNode(Attr oldAttr) throws DOMException(Code) | | Remove the specified attribute/value pair. If the removed
Attribute has a default value, it is immediately replaced.
NOTE: Specifically removes THIS NODE -- not the node with this
name, nor the node with these contents. If the specific Attribute
object passed in is not stored in this Element, we throw a
DOMException. If you really want to remove an attribute by name,
use removeAttribute().
the Attribute object that was removed. throws: DOMException - (NOT_FOUND_ERR) if oldattr is not an attribute ofthis Element. throws: DOMException - (NO_MODIFICATION_ALLOWED_ERR) if the node isreadonly. |
setAttribute | public void setAttribute(String name, String value)(Code) | | Add a new name/value pair, or replace the value of the existing
attribute having that name.
Note: this method supports only the simplest kind of Attribute,
one whose value is a string contained in a single Text node.
If you want to assert a more complex value (which XML permits,
though HTML doesn't), see setAttributeNode().
The attribute is created with specified=true, meaning it's an
explicit value rather than inherited from the DTD as a default.
Again, setAttributeNode can be used to achieve other results.
throws: DOMException - (INVALID_NAME_ERR) if the name is not acceptable.(Attribute factory will do that test for us.) throws: DOMException - (NO_MODIFICATION_ALLOWED_ERR) if the node isreadonly. |
setAttributeNS | public void setAttributeNS(String namespaceURI, String qualifiedName, String value)(Code) | | Introduced in DOM Level 2.
Adds a new attribute.
If the given namespaceURI is null or an empty string and the
qualifiedName has a prefix that is "xml", the new attribute is bound to
the predefined namespace "http://www.w3.org/XML/1998/namespace"
[Namespaces]. If an attribute with the same local name and namespace
URI is already present on the element, its prefix is changed to be the
prefix part of the qualifiedName, and its value is changed to be 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 setAttributeNodeNS or
setAttributeNode to assign it as the value of an attribute.
Parameters: namespaceURI - The namespace URI of the attribute to createor alter. Parameters: qualifiedName - The qualified name of the attribute to create oralter. Parameters: value - The value to set in string form. throws: INVALID_CHARACTER_ERR - : Raised if the specifiedname contains an invalid character. throws: NO_MODIFICATION_ALLOWED_ERR - : Raised if thisnode is readonly. throws: NAMESPACE_ERR - : Raised if the qualifiedNamehas a prefix that is "xml" and the namespaceURIis neither null nor an empty string nor"http://www.w3.org/XML/1998/namespace", or ifthe qualifiedName has a prefix that is "xmlns"but the namespaceURI is neither null nor anempty string, or if if the qualifiedName has aprefix different from "xml" and "xmlns" and thenamespaceURI is null or an empty string. since: WD-DOM-Level-2-19990923 |
setAttributeNode | public Attr setAttributeNode(Attr newAttr) throws DOMException(Code) | | Add a new attribute/value pair, or replace the value of the
existing attribute with that name.
This method allows you to add an Attribute that has already been
constructed, and hence avoids the limitations of the simple
setAttribute() call. It can handle attribute values that have
arbitrarily complex tree structure -- in particular, those which
had entity references mixed into their text.
throws: DOMException - (INUSE_ATTRIBUTE_ERR) if the Attribute objecthas already been assigned to another Element. |
setAttributeNodeNS | public Attr setAttributeNodeNS(Attr newAttr) throws DOMException(Code) | | Introduced in DOM Level 2.
Adds a new attribute. If an attribute with that local name and
namespace URI is already present in the element, it is replaced
by the new one.
Parameters: newAttr - The Attr node to add to the attribute list. Whenthe Node has no namespaceURI, this method behaveslike setAttributeNode. Attr If the newAttr attribute replaces an existing attributewith the same local name and namespace URI, the *previously existing Attr node is returned, otherwisenull is returned. throws: WRONG_DOCUMENT_ERR - : Raised if newAttrwas created from a different document than the one thatcreated the element. throws: NO_MODIFICATION_ALLOWED_ERR - : Raised ifthis node is readonly. throws: INUSE_ATTRIBUTE_ERR - : Raised if newAttr isalready an attribute of another Element object. TheDOM user must explicitly clone Attr nodes to re-usethem in other elements. since: WD-DOM-Level-2-19990923 |
setIdAttribute | public void setIdAttribute(String name, boolean makeId)(Code) | | DOM Level 3: register the given attribute node as an ID attribute
|
setIdAttributeNS | public void setIdAttributeNS(String namespaceURI, String localName, boolean makeId)(Code) | | DOM Level 3: register the given attribute node as an ID attribute
|
setIdAttributeNode | public void setIdAttributeNode(Attr at, boolean makeId)(Code) | | DOM Level 3: register the given attribute node as an ID attribute
|
setOwnerDocument | protected void setOwnerDocument(CoreDocumentImpl doc)(Code) | | NON-DOM
set the ownerDocument of this node, its children, and its attributes
|
setReadOnly | public void setReadOnly(boolean readOnly, boolean deep)(Code) | | NON-DOM: Subclassed to flip the attributes' readonly switch as well.
See Also: NodeImpl.setReadOnly |
setXercesAttributeNode | protected int setXercesAttributeNode(Attr attr)(Code) | | NON-DOM: sets attribute node for this element
|
setupDefaultAttributes | protected void setupDefaultAttributes()(Code) | | Setup the default attributes.
|
synchronizeData | protected void synchronizeData()(Code) | | Synchronizes the data (name and value) for fast nodes.
|
Methods inherited from org.apache.xerces.dom.NodeImpl | public void addEventListener(String type, EventListener listener, boolean useCapture)(Code)(Java Doc) public Node appendChild(Node newChild) throws DOMException(Code)(Java Doc) protected void changed()(Code)(Java Doc) protected int changes()(Code)(Java Doc) public Node cloneNode(boolean deep)(Code)(Java Doc) public short compareDocumentPosition(Node other) throws DOMException(Code)(Java Doc) public short compareTreePosition(Node other)(Code)(Java Doc) public boolean dispatchEvent(Event event)(Code)(Java Doc) public NamedNodeMap getAttributes()(Code)(Java Doc) public String getBaseURI()(Code)(Java Doc) public NodeList getChildNodes()(Code)(Java Doc) protected Node getContainer()(Code)(Java Doc) Node getElementAncestor(Node currentNode)(Code)(Java Doc) public Object getFeature(String feature, String version)(Code)(Java Doc) public Node getFirstChild()(Code)(Java Doc) public Node getLastChild()(Code)(Java Doc) public int getLength()(Code)(Java Doc) public String getLocalName()(Code)(Java Doc) public String getNamespaceURI()(Code)(Java Doc) public Node getNextSibling()(Code)(Java Doc) abstract public String getNodeName()(Code)(Java Doc) protected int getNodeNumber()(Code)(Java Doc) abstract public short getNodeType()(Code)(Java Doc) public String getNodeValue() throws DOMException(Code)(Java Doc) public Document getOwnerDocument()(Code)(Java Doc) public Node getParentNode()(Code)(Java Doc) public String getPrefix()(Code)(Java Doc) public Node getPreviousSibling()(Code)(Java Doc) public boolean getReadOnly()(Code)(Java Doc) public String getTextContent() throws DOMException(Code)(Java Doc) void getTextContent(StringBuffer buf) throws DOMException(Code)(Java Doc) public Object getUserData(String key)(Code)(Java Doc) public Object getUserData()(Code)(Java Doc) protected Hashtable getUserDataRecord()(Code)(Java Doc) public boolean hasAttributes()(Code)(Java Doc) public boolean hasChildNodes()(Code)(Java Doc) final boolean hasStringValue()(Code)(Java Doc) final void hasStringValue(boolean value)(Code)(Java Doc) public Node insertBefore(Node newChild, Node refChild) throws DOMException(Code)(Java Doc) final boolean internalIsIgnorableWhitespace()(Code)(Java Doc) public boolean isDefaultNamespace(String namespaceURI)(Code)(Java Doc) public boolean isEqualNode(Node arg)(Code)(Java Doc) final boolean isFirstChild()(Code)(Java Doc) final void isFirstChild(boolean value)(Code)(Java Doc) final boolean isIdAttribute()(Code)(Java Doc) final void isIdAttribute(boolean value)(Code)(Java Doc) final void isIgnorableWhitespace(boolean value)(Code)(Java Doc) final boolean isNormalized()(Code)(Java Doc) final void isNormalized(boolean value)(Code)(Java Doc) final boolean isOwned()(Code)(Java Doc) final void isOwned(boolean value)(Code)(Java Doc) final boolean isReadOnly()(Code)(Java Doc) final void isReadOnly(boolean value)(Code)(Java Doc) public boolean isSameNode(Node other)(Code)(Java Doc) final boolean isSpecified()(Code)(Java Doc) final void isSpecified(boolean value)(Code)(Java Doc) public boolean isSupported(String feature, String version)(Code)(Java Doc) public Node item(int index)(Code)(Java Doc) String lookupNamespacePrefix(String namespaceURI, ElementImpl el)(Code)(Java Doc) public String lookupNamespaceURI(String specifiedPrefix)(Code)(Java Doc) public String lookupPrefix(String namespaceURI)(Code)(Java Doc) final boolean needsSyncChildren()(Code)(Java Doc) final public void needsSyncChildren(boolean value)(Code)(Java Doc) final boolean needsSyncData()(Code)(Java Doc) final void needsSyncData(boolean value)(Code)(Java Doc) public void normalize()(Code)(Java Doc) CoreDocumentImpl ownerDocument()(Code)(Java Doc) NodeImpl parentNode()(Code)(Java Doc) ChildNode previousSibling()(Code)(Java Doc) public Node removeChild(Node oldChild) throws DOMException(Code)(Java Doc) public void removeEventListener(String type, EventListener listener, boolean useCapture)(Code)(Java Doc) public Node replaceChild(Node newChild, Node oldChild) throws DOMException(Code)(Java Doc) public void setNodeValue(String x) throws DOMException(Code)(Java Doc) protected void setOwnerDocument(CoreDocumentImpl doc)(Code)(Java Doc) public void setPrefix(String prefix) throws DOMException(Code)(Java Doc) public void setReadOnly(boolean readOnly, boolean deep)(Code)(Java Doc) public void setTextContent(String textContent) throws DOMException(Code)(Java Doc) public Object setUserData(String key, Object data, UserDataHandler handler)(Code)(Java Doc) public void setUserData(Object data)(Code)(Java Doc) protected void synchronizeData()(Code)(Java Doc) public String toString()(Code)(Java Doc)
|
|
|