|
BEA Systems, Inc. | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object weblogic.apache.xerces.dom.NodeImpl weblogic.apache.xerces.dom.ChildNode weblogic.apache.xerces.dom.ParentNode weblogic.apache.xerces.dom.ElementImpl
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.
ElementNSImpl
,
Serialized FormField Summary | |
protected AttributeMap |
attributes
Deprecated. Attributes. |
protected String |
name
Deprecated. Element name. |
Fields inherited from class weblogic.apache.xerces.dom.ParentNode |
firstChild, fNodeListCache, ownerDocument |
Fields inherited from class weblogic.apache.xerces.dom.ChildNode |
nextSibling, previousSibling |
Fields inherited from class weblogic.apache.xerces.dom.NodeImpl |
ELEMENT_DEFINITION_NODE, FIRSTCHILD, flags, HASSTRING, IDATTRIBUTE, IGNORABLEWS, OWNED, ownerNode, READONLY, SPECIFIED, SYNCCHILDREN, SYNCDATA, TREE_POSITION_ANCESTOR, TREE_POSITION_DESCENDANT, TREE_POSITION_DISCONNECTED, TREE_POSITION_EQUIVALENT, TREE_POSITION_FOLLOWING, TREE_POSITION_PRECEDING, TREE_POSITION_SAME_NODE, UNNORMALIZED |
Constructor Summary | |
protected |
ElementImpl()
Deprecated. |
|
ElementImpl(CoreDocumentImpl ownerDoc,
String name)
Deprecated. Factory constructor. |
Method Summary | |
Node |
cloneNode(boolean deep)
Deprecated. Return a duplicate copy of this Element. |
String |
getAttribute(String name)
Deprecated. Look up a single Attribute by name. |
Attr |
getAttributeNode(String name)
Deprecated. Look up a single Attribute by name. |
Attr |
getAttributeNodeNS(String namespaceURI,
String localName)
Deprecated. Retrieves an Attr node by local name and namespace URI. |
String |
getAttributeNS(String namespaceURI,
String localName)
Deprecated. Introduced in DOM Level 2. |
NamedNodeMap |
getAttributes()
Deprecated. Retrieve all the Attributes as a set. |
String |
getBaseURI()
Deprecated. DOM Level 3 WD - Experimental. |
protected NamedNodeMapImpl |
getDefaultAttributes()
Deprecated. Get the default attributes. |
NodeList |
getElementsByTagName(String tagname)
Deprecated. Returns a NodeList of all descendent nodes (children, grandchildren, and so on) which are Elements and which have the specified tag name. |
NodeList |
getElementsByTagNameNS(String namespaceURI,
String localName)
Deprecated. Introduced in DOM Level 2. |
String |
getNodeName()
Deprecated. Returns the element name |
short |
getNodeType()
Deprecated. A short integer indicating what type of node this is. |
String |
getTagName()
Deprecated. Returns the name of the Element. |
boolean |
hasAttribute(String name)
Deprecated. Introduced in DOM Level 2. |
boolean |
hasAttributeNS(String namespaceURI,
String localName)
Deprecated. Introduced in DOM Level 2. |
boolean |
hasAttributes()
Deprecated. Introduced in DOM Level 2. |
boolean |
isEqualNode(Node arg)
Deprecated. DOM Level 3 WD- Experimental. |
void |
normalize()
Deprecated. In "normal form" (as read from a source file), there will never be two Text children in succession. |
protected void |
reconcileDefaultAttributes()
Deprecated. Reconcile default attributes. |
void |
removeAttribute(String name)
Deprecated. Remove the named attribute from this Element. |
Attr |
removeAttributeNode(Attr oldAttr)
Deprecated. Remove the specified attribute/value pair. |
void |
removeAttributeNS(String namespaceURI,
String localName)
Deprecated. Introduced in DOM Level 2. |
void |
setAttribute(String name,
String value)
Deprecated. Add a new name/value pair, or replace the value of the existing attribute having that name. |
Attr |
setAttributeNode(Attr newAttr)
Deprecated. Add a new attribute/value pair, or replace the value of the existing attribute with that name. |
Attr |
setAttributeNodeNS(Attr newAttr)
Deprecated. Introduced in DOM Level 2. |
void |
setAttributeNS(String namespaceURI,
String qualifiedName,
String value)
Deprecated. Introduced in DOM Level 2. |
void |
setIdAttributeNode(Attr at)
Deprecated. NON-DOM: register the given attribute node as an ID attribute |
void |
setReadOnly(boolean readOnly,
boolean deep)
Deprecated. NON-DOM: Subclassed to flip the attributes' readonly switch as well. |
protected void |
setupDefaultAttributes()
Deprecated. Setup the default attributes. |
protected int |
setXercesAttributeNode(Attr attr)
Deprecated. NON-DOM: sets attribute node for this element |
protected void |
synchronizeData()
Deprecated. Synchronizes the data (name and value) for fast nodes. |
Methods inherited from class weblogic.apache.xerces.dom.ParentNode |
getChildNodes, getChildNodesUnoptimized, getFirstChild, getLastChild, getLength, getOwnerDocument, getTextContent, hasChildNodes, insertBefore, item, removeChild, replaceChild, setTextContent, synchronizeChildren |
Methods inherited from class weblogic.apache.xerces.dom.ChildNode |
getNextSibling, getParentNode, getPreviousSibling |
Methods inherited from class weblogic.apache.xerces.dom.NodeImpl |
addEventListener, appendChild, changed, changes, compareTreePosition, dispatchEvent, getInterface, getLocalName, getNamespaceURI, getNodeValue, getPrefix, getReadOnly, getUserData, getUserData, isDefaultNamespace, isSameNode, isSupported, lookupNamespacePrefix, lookupNamespaceURI, needsSyncChildren, removeEventListener, setNodeValue, setPrefix, setUserData, setUserData, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.w3c.dom.Node |
appendChild, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasChildNodes, insertBefore, isDefaultNamespace, isSameNode, isSupported, lookupNamespaceURI, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent |
Field Detail |
protected AttributeMap attributes
protected String name
Constructor Detail |
protected ElementImpl()
public ElementImpl(CoreDocumentImpl ownerDoc, String name)
Method Detail |
public Node cloneNode(boolean deep)
cloneNode
in interface Node
cloneNode
in class ParentNode
Node.cloneNode(boolean)
public String getAttribute(String name)
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().
getAttribute
in interface Element
public Attr getAttributeNode(String name)
If no matching attribute is available, returns null.
getAttributeNode
in interface Element
public Attr getAttributeNodeNS(String namespaceURI, String localName)
getAttributeNodeNS
in interface Element
namespaceURI
- The namespace URI of the attribute to
retrieve.localName
- The local name of the attribute to retrieve.
public String getAttributeNS(String namespaceURI, String localName)
Retrieves an attribute value by local name and namespace URI.
getAttributeNS
in interface Element
namespaceURI
- The namespace URI of the attribute to
retrieve.localName
- The local name of the attribute to retrieve.
public NamedNodeMap getAttributes()
getAttributes
in interface Node
getAttributes
in class NodeImpl
ElementImpl
public String getBaseURI()
getBaseURI
in interface Node
getBaseURI
in class NodeImpl
protected NamedNodeMapImpl getDefaultAttributes()
public NodeList getElementsByTagName(String tagname)
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.
getElementsByTagName
in interface Element
tagname
- The type of element to gather. To obtain a list of
all elements no matter what their names, use the wild-card tag
name "*".DeepNodeListImpl
public NodeList getElementsByTagNameNS(String namespaceURI, String localName)
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.
getElementsByTagNameNS
in interface Element
namespaceURI
- The namespace URI of the elements to match
on. The special value "*" matches all
namespaces. When it is null or an empty
string, this method behaves like
getElementsByTagName.localName
- The local name of the elements to match on.
The special value "*" matches all local names.
public String getNodeName()
getNodeName
in interface Node
getNodeName
in class NodeImpl
public short getNodeType()
getNodeType
in interface Node
getNodeType
in class NodeImpl
public String getTagName()
This is case-preserving in XML. HTML should uppercasify it on the way in.
getTagName
in interface Element
public boolean hasAttribute(String name)
hasAttribute
in interface Element
public boolean hasAttributeNS(String namespaceURI, String localName)
hasAttributeNS
in interface Element
public boolean hasAttributes()
hasAttributes
in interface Node
hasAttributes
in class NodeImpl
true
if this node has any attributes,
false
otherwise.ElementImpl
public boolean isEqualNode(Node arg)
isEqualNode
in interface Node
isEqualNode
in class ParentNode
public void normalize()
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.
normalize
in interface Node
normalize
in class ParentNode
protected void reconcileDefaultAttributes()
public void removeAttribute(String name)
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.
removeAttribute
in interface Element
DOMException(NO_MODIFICATION_ALLOWED_ERR)
- if the node is
readonly.public Attr removeAttributeNode(Attr oldAttr) throws DOMException
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().
removeAttributeNode
in interface Element
DOMException(NOT_FOUND_ERR)
- if oldattr is not an attribute of
this Element.
DOMException(NO_MODIFICATION_ALLOWED_ERR)
- if the node is
readonly.
DOMException
public void removeAttributeNS(String namespaceURI, String localName)
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.
removeAttributeNS
in interface Element
namespaceURI
- The namespace URI of the attribute to remove.localName
- The local name of the attribute to remove.
NO_MODIFICATION_ALLOWED_ERR:
- Raised if this
node is readonly.public void setAttribute(String name, String value)
setAttribute
in interface Element
DOMException(INVALID_NAME_ERR)
- if the name is not acceptable.
(Attribute factory will do that test for us.)
DOMException(NO_MODIFICATION_ALLOWED_ERR)
- if the node is
readonly.public Attr setAttributeNode(Attr newAttr) throws DOMException
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.
setAttributeNode
in interface Element
DOMException(INUSE_ATTRIBUTE_ERR)
- if the Attribute object
has already been assigned to another Element.
DOMException
public Attr setAttributeNodeNS(Attr newAttr) throws DOMException
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.
setAttributeNodeNS
in interface Element
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.
DOMException
public void setAttributeNS(String namespaceURI, String qualifiedName, String value)
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.
setAttributeNS
in interface Element
namespaceURI
- The namespace URI of the attribute to create
or alter.qualifiedName
- The qualified name of the attribute to create or
alter.value
- The value to set in string form.
INVALID_CHARACTER_ERR:
- Raised if the specified
name contains an invalid character.
NO_MODIFICATION_ALLOWED_ERR:
- Raised if this
node is readonly.
NAMESPACE_ERR:
- Raised if the qualifiedName
has a prefix that is "xml" and the namespaceURI
is neither null nor an empty string nor
"http://www.w3.org/XML/1998/namespace", or if
the qualifiedName has a prefix that is "xmlns"
but the namespaceURI is neither null nor an
empty string, or if if the qualifiedName has a
prefix different from "xml" and "xmlns" and the
namespaceURI is null or an empty string.public void setIdAttributeNode(Attr at)
public void setReadOnly(boolean readOnly, boolean deep)
setReadOnly
in class ParentNode
NodeImpl.setReadOnly(boolean, boolean)
protected void setupDefaultAttributes()
protected int setXercesAttributeNode(Attr attr)
protected void synchronizeData()
synchronizeData
in class NodeImpl
|
Documentation is available at http://download.oracle.com/docs/cd/E13222_01/wls/docs90 Copyright 2005 BEA Systems Inc. |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |