|
|||||||||
| Home >> All >> gnu >> xml >> [ dom overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
gnu.xml.dom
Class DomElement

java.lang.Objectgnu.xml.dom.DomNode
gnu.xml.dom.DomNsNode
gnu.xml.dom.DomElement
- All Implemented Interfaces:
- java.lang.Cloneable, java.lang.Comparable, org.w3c.dom.events.DocumentEvent, org.w3c.dom.Element, org.w3c.dom.events.EventTarget, org.w3c.dom.Node, org.w3c.dom.NodeList
- public class DomElement
- extends DomNsNode
- implements org.w3c.dom.Element
- extends DomNsNode
"Element" implementation.
| Nested Class Summary |
| Nested classes inherited from class gnu.xml.dom.DomNode |
DomNode.DomEventException, DomNode.ListenerRecord, DomNode.LiveNodeList, DomNode.ShadowList |
| Field Summary | |
private DomNamedNodeMap |
attributes
|
(package private) java.util.Set |
userIdAttrs
User-defined ID attributes. |
(package private) java.lang.String |
xmlSpace
|
| Fields inherited from class gnu.xml.dom.DomNsNode |
localName |
| Fields inherited from class gnu.xml.dom.DomNode |
depth, first, index, last, length, next, nodeType, owner, parent, previous, readonly, reportMutations |
| Constructor Summary | |
protected |
DomElement(DomDocument owner,
java.lang.String namespaceURI,
java.lang.String name)
Constructs an Element node associated with the specified document. |
| Method Summary | |
java.lang.Object |
clone()
Shallow clone of the element, except that associated attributes are (deep) cloned. |
java.lang.String |
getAttribute(java.lang.String name)
DOM L1 Returns the value of the specified attribute, or an empty string. |
org.w3c.dom.Attr |
getAttributeNode(java.lang.String name)
DOM L1 Returns the appropriate attribute node; the name is the nodeName property of the attribute. |
org.w3c.dom.Attr |
getAttributeNodeNS(java.lang.String namespace,
java.lang.String localPart)
DOM L2 Returns the appropriate attribute node; the name combines the namespace name and the local part. |
java.lang.String |
getAttributeNS(java.lang.String namespaceURI,
java.lang.String local)
DOM L2 Returns the value of the specified attribute, or an empty string. |
org.w3c.dom.NamedNodeMap |
getAttributes()
DOM L1 Returns the element's attributes |
java.lang.String |
getBaseURI()
The absolute base URI of this node or null if the
implementation wasn't able to obtain an absolute URI. |
org.w3c.dom.TypeInfo |
getSchemaTypeInfo()
The type information associated with this element. |
java.lang.String |
getTagName()
DOM L1 Returns the element name (same as getNodeName). |
boolean |
hasAttribute(java.lang.String name)
DOM L2 Returns true if the element has an attribute with the specified name (specified or DTD defaulted). |
boolean |
hasAttributeNS(java.lang.String namespaceURI,
java.lang.String local)
DOM L2 Returns true if the element has an attribute with the specified name (specified or DTD defaulted). |
boolean |
hasAttributes()
DOM L2> Returns true iff this is an element node with attributes. |
boolean |
isDefaultNamespace(java.lang.String namespaceURI)
This method checks if the specified namespaceURI is the
default namespace or not. |
boolean |
isEqualNode(org.w3c.dom.Node arg)
Tests whether two nodes are equal. |
java.lang.String |
lookupNamespaceURI(java.lang.String prefix)
Look up the namespace URI associated to the given prefix, starting from this node. |
java.lang.String |
lookupPrefix(java.lang.String namespaceURI)
Look up the prefix associated to the given namespace URI, starting from this node. |
void |
makeReadonly()
Marks this element, its children, and its associated attributes as readonly. |
void |
removeAttribute(java.lang.String name)
DOM L1 Removes the appropriate attribute node. |
org.w3c.dom.Attr |
removeAttributeNode(org.w3c.dom.Attr node)
DOM L1 Removes the appropriate attribute node; the name is the nodeName property of the attribute. |
void |
removeAttributeNS(java.lang.String namespace,
java.lang.String localPart)
DOM L2 Removes the appropriate attribute node; the name combines the namespace name and the local part. |
void |
setAttribute(java.lang.String name,
java.lang.String value)
DOM L1 Modifies an existing attribute to have the specified value, or creates a new one with that value. |
org.w3c.dom.Attr |
setAttributeNode(org.w3c.dom.Attr attr)
DOM L1 Stores the specified attribute, optionally overwriting any existing one with that name. |
org.w3c.dom.Attr |
setAttributeNodeNS(org.w3c.dom.Attr attr)
DOM L2 Stores the specified attribute, optionally overwriting any existing one with that name. |
void |
setAttributeNS(java.lang.String uri,
java.lang.String aname,
java.lang.String value)
DOM L2 Modifies an existing attribute to have the specified value, or creates a new one with that value. |
void |
setIdAttribute(java.lang.String name,
boolean isId)
If the parameter isId is true, this method
declares the specified attribute to be a user-determined ID attribute
. |
void |
setIdAttributeNode(org.w3c.dom.Attr attr,
boolean isId)
If the parameter isId is true, this method
declares the specified attribute to be a user-determined ID attribute
. |
void |
setIdAttributeNS(java.lang.String namespaceURI,
java.lang.String localName,
boolean isId)
If the parameter isId is true, this method
declares the specified attribute to be a user-determined ID attribute
. |
(package private) void |
setOwner(DomDocument doc)
Used to adopt a node to a new document. |
| Methods inherited from class gnu.xml.dom.DomNsNode |
getLocalName, getNamespaceURI, getNodeName, getPrefix, setNamespaceURI, setNodeName, setPrefix |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.w3c.dom.Element |
getElementsByTagName, getElementsByTagNameNS |
| Methods inherited from interface org.w3c.dom.Node |
appendChild, cloneNode, compareDocumentPosition, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasChildNodes, insertBefore, isSameNode, isSupported, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData |
| Field Detail |
userIdAttrs
java.util.Set userIdAttrs
- User-defined ID attributes.
Used by DomAttr.isId and DomDocument.getElementById
attributes
private DomNamedNodeMap attributes
xmlSpace
java.lang.String xmlSpace
| Constructor Detail |
DomElement
protected DomElement(DomDocument owner, java.lang.String namespaceURI, java.lang.String name)
- Constructs an Element node associated with the specified document.
This constructor should only be invoked by a Document as part of its createElement functionality, or through a subclass which is similarly used in a "Sub-DOM" style layer.
| Method Detail |
getAttributes
public org.w3c.dom.NamedNodeMap getAttributes()
- DOM L1
Returns the element's attributes
- Specified by:
getAttributesin interfaceorg.w3c.dom.Node- Overrides:
getAttributesin classDomNode
hasAttributes
public boolean hasAttributes()
- DOM L2>
Returns true iff this is an element node with attributes.
- Specified by:
hasAttributesin interfaceorg.w3c.dom.Node- Overrides:
hasAttributesin classDomNode
clone
public java.lang.Object clone()
- Shallow clone of the element, except that associated
attributes are (deep) cloned.
setOwner
void setOwner(DomDocument doc)
- Description copied from class:
DomNode - Used to adopt a node to a new document.
makeReadonly
public void makeReadonly()
- Marks this element, its children, and its associated attributes as
readonly.
- Overrides:
makeReadonlyin classDomNode
getTagName
public final java.lang.String getTagName()
- DOM L1
Returns the element name (same as getNodeName).
- Specified by:
getTagNamein interfaceorg.w3c.dom.Element
getAttribute
public java.lang.String getAttribute(java.lang.String name)
- DOM L1
Returns the value of the specified attribute, or an
empty string.
- Specified by:
getAttributein interfaceorg.w3c.dom.Element
hasAttribute
public boolean hasAttribute(java.lang.String name)
- DOM L2
Returns true if the element has an attribute with the
specified name (specified or DTD defaulted).
- Specified by:
hasAttributein interfaceorg.w3c.dom.Element
hasAttributeNS
public boolean hasAttributeNS(java.lang.String namespaceURI, java.lang.String local)
- DOM L2
Returns true if the element has an attribute with the
specified name (specified or DTD defaulted).
- Specified by:
hasAttributeNSin interfaceorg.w3c.dom.Element
getAttributeNS
public java.lang.String getAttributeNS(java.lang.String namespaceURI, java.lang.String local)
- DOM L2
Returns the value of the specified attribute, or an
empty string.
- Specified by:
getAttributeNSin interfaceorg.w3c.dom.Element
getAttributeNode
public org.w3c.dom.Attr getAttributeNode(java.lang.String name)
- DOM L1
Returns the appropriate attribute node; the name is the
nodeName property of the attribute.
- Specified by:
getAttributeNodein interfaceorg.w3c.dom.Element
getAttributeNodeNS
public org.w3c.dom.Attr getAttributeNodeNS(java.lang.String namespace, java.lang.String localPart)
- DOM L2
Returns the appropriate attribute node; the name combines
the namespace name and the local part.
- Specified by:
getAttributeNodeNSin interfaceorg.w3c.dom.Element
setAttribute
public void setAttribute(java.lang.String name, java.lang.String value)
- DOM L1
Modifies an existing attribute to have the specified value,
or creates a new one with that value. The name used is the
nodeName value.
- Specified by:
setAttributein interfaceorg.w3c.dom.Element
setAttributeNS
public void setAttributeNS(java.lang.String uri, java.lang.String aname, java.lang.String value)
- DOM L2
Modifies an existing attribute to have the specified value,
or creates a new one with that value.
- Specified by:
setAttributeNSin interfaceorg.w3c.dom.Element
setAttributeNode
public org.w3c.dom.Attr setAttributeNode(org.w3c.dom.Attr attr)
- DOM L1
Stores the specified attribute, optionally overwriting any
existing one with that name.
- Specified by:
setAttributeNodein interfaceorg.w3c.dom.Element
setAttributeNodeNS
public org.w3c.dom.Attr setAttributeNodeNS(org.w3c.dom.Attr attr)
- DOM L2
Stores the specified attribute, optionally overwriting any
existing one with that name.
- Specified by:
setAttributeNodeNSin interfaceorg.w3c.dom.Element
removeAttribute
public void removeAttribute(java.lang.String name)
- DOM L1
Removes the appropriate attribute node.
If there is no such node, this is (bizarrely enough) a NOP so you
won't see exceptions if your code deletes non-existent attributes.
Note that since there is no portable way for DOM to record DTD information, default values for attributes will never be provided automatically.
- Specified by:
removeAttributein interfaceorg.w3c.dom.Element
removeAttributeNode
public org.w3c.dom.Attr removeAttributeNode(org.w3c.dom.Attr node)
- DOM L1
Removes the appropriate attribute node; the name is the
nodeName property of the attribute.
Note that since there is no portable way for DOM to record DTD information, default values for attributes will never be provided automatically.
- Specified by:
removeAttributeNodein interfaceorg.w3c.dom.Element
removeAttributeNS
public void removeAttributeNS(java.lang.String namespace, java.lang.String localPart)
- DOM L2
Removes the appropriate attribute node; the name combines
the namespace name and the local part.
Note that since there is no portable way for DOM to record DTD information, default values for attributes will never be provided automatically.
- Specified by:
removeAttributeNSin interfaceorg.w3c.dom.Element
lookupPrefix
public java.lang.String lookupPrefix(java.lang.String namespaceURI)
- Description copied from interface:
org.w3c.dom.Node - Look up the prefix associated to the given namespace URI, starting from
this node. The default namespace declarations are ignored by this
method.
See for details on the algorithm used by this method.- Specified by:
lookupPrefixin interfaceorg.w3c.dom.Node- Overrides:
lookupPrefixin classDomNode
isDefaultNamespace
public boolean isDefaultNamespace(java.lang.String namespaceURI)
- Description copied from interface:
org.w3c.dom.Node - This method checks if the specified
namespaceURIis the default namespace or not.- Specified by:
isDefaultNamespacein interfaceorg.w3c.dom.Node- Overrides:
isDefaultNamespacein classDomNode
lookupNamespaceURI
public java.lang.String lookupNamespaceURI(java.lang.String prefix)
- Description copied from interface:
org.w3c.dom.Node - Look up the namespace URI associated to the given prefix, starting from
this node.
See for details on the algorithm used by this method.- Specified by:
lookupNamespaceURIin interfaceorg.w3c.dom.Node- Overrides:
lookupNamespaceURIin classDomNode
getBaseURI
public java.lang.String getBaseURI()
- Description copied from interface:
org.w3c.dom.Node - The absolute base URI of this node or
nullif the implementation wasn't able to obtain an absolute URI. This value is computed as described in . However, when theDocumentsupports the feature "HTML" [DOM Level 2 HTML] , the base URI is computed using first the value of the href attribute of the HTML BASE element if any, and the value of thedocumentURIattribute from theDocumentinterface otherwise.- Specified by:
getBaseURIin interfaceorg.w3c.dom.Node- Overrides:
getBaseURIin classDomNode
getSchemaTypeInfo
public org.w3c.dom.TypeInfo getSchemaTypeInfo()
- Description copied from interface:
org.w3c.dom.Element - The type information associated with this element.
- Specified by:
getSchemaTypeInfoin interfaceorg.w3c.dom.Element
setIdAttribute
public void setIdAttribute(java.lang.String name, boolean isId)
- Description copied from interface:
org.w3c.dom.Element - If the parameter
isIdistrue, this method declares the specified attribute to be a user-determined ID attribute . This affects the value ofAttr.isIdand the behavior ofDocument.getElementById, but does not change any schema that may be in use, in particular this does not affect theAttr.schemaTypeInfoof the specifiedAttrnode. Use the valuefalsefor the parameterisIdto undeclare an attribute for being a user-determined ID attribute.
To specify an attribute by local name and namespace URI, use thesetIdAttributeNSmethod.- Specified by:
setIdAttributein interfaceorg.w3c.dom.Element
setIdAttributeNode
public void setIdAttributeNode(org.w3c.dom.Attr attr, boolean isId)
- Description copied from interface:
org.w3c.dom.Element - If the parameter
isIdistrue, this method declares the specified attribute to be a user-determined ID attribute . This affects the value ofAttr.isIdand the behavior ofDocument.getElementById, but does not change any schema that may be in use, in particular this does not affect theAttr.schemaTypeInfoof the specifiedAttrnode. Use the valuefalsefor the parameterisIdto undeclare an attribute for being a user-determined ID attribute.- Specified by:
setIdAttributeNodein interfaceorg.w3c.dom.Element
setIdAttributeNS
public void setIdAttributeNS(java.lang.String namespaceURI, java.lang.String localName, boolean isId)
- Description copied from interface:
org.w3c.dom.Element - If the parameter
isIdistrue, this method declares the specified attribute to be a user-determined ID attribute . This affects the value ofAttr.isIdand the behavior ofDocument.getElementById, but does not change any schema that may be in use, in particular this does not affect theAttr.schemaTypeInfoof the specifiedAttrnode. Use the valuefalsefor the parameterisIdto undeclare an attribute for being a user-determined ID attribute.- Specified by:
setIdAttributeNSin interfaceorg.w3c.dom.Element
isEqualNode
public boolean isEqualNode(org.w3c.dom.Node arg)
- Description copied from interface:
org.w3c.dom.Node - Tests whether two nodes are equal.
This method tests for equality of nodes, not sameness (i.e., whether the two nodes are references to the same object) which can be tested withNode.isSameNode(). All nodes that are the same will also be equal, though the reverse may not be true.
Two nodes are equal if and only if the following conditions are satisfied:- The two nodes are of the same type.
- The following string
attributes are equal:
nodeName,localName,namespaceURI,prefix,nodeValue. This is: they are bothnull, or they have the same length and are character for character identical. - The
attributesNamedNodeMapsare equal. This is: they are bothnull, or they have the same length and for each node that exists in one map there is a node that exists in the other map and is equal, although not necessarily at the same index. - The
childNodesNodeListsare equal. This is: they are bothnull, or they have the same length and contain equal nodes at the same index. Note that normalization can affect equality; to avoid this, nodes should be normalized before being compared.
For twoDocumentTypenodes to be equal, the following conditions must also be satisfied:- The following string attributes
are equal:
publicId,systemId,internalSubset. - The
entitiesNamedNodeMapsare equal. - The
notationsNamedNodeMapsare equal.
On the other hand, the following do not affect equality: theownerDocument,baseURI, andparentNodeattributes, thespecifiedattribute forAttrnodes, theschemaTypeInfoattribute forAttrandElementnodes, theText.isElementContentWhitespaceattribute forTextnodes, as well as any user data or event listeners registered on the nodes.Note: As a general rule, anything not mentioned in the description above is not significant in consideration of equality checking. Note that future versions of this specification may take into account more attributes and implementations conform to this specification are expected to be updated accordingly.
- Specified by:
isEqualNodein interfaceorg.w3c.dom.Node- Overrides:
isEqualNodein classDomNode
|
|||||||||
| Home >> All >> gnu >> xml >> [ dom overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC