Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
gnu.xml.dom.DomNode
gnu.xml.dom.DomNsNode
gnu.xml.dom.DomElement
Constructor Summary | |
|
Method Summary | |
Object |
|
String |
|
String |
|
Attr |
|
Attr |
|
NamedNodeMap |
|
String |
|
TypeInfo |
|
String |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
String |
|
String |
|
void |
|
void |
|
void |
|
Attr |
|
void |
|
void |
|
Attr |
|
Attr |
|
void |
|
void |
|
void |
|
Methods inherited from class gnu.xml.dom.DomNsNode | |
getLocalName , getNamespaceURI , getNodeName , getPrefix , setPrefix |
protected DomElement(DomDocument owner, String namespaceURI, 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.
- Parameters:
owner
- The document with which this node is associatednamespaceURI
- Combined with the local part of the name, this is used to uniquely identify a type of elementname
- Name of this element, which may include a prefix
public Object clone()
Shallow clone of the element, except that associated attributes are (deep) cloned.
- Overrides:
- clone in interface DomNode
public String getAttribute(String name)
DOM L1 Returns the value of the specified attribute, or an empty string.
- Specified by:
- getAttribute in interface Element
public String getAttributeNS(String namespaceURI, String local)
DOM L2 Returns the value of the specified attribute, or an empty string.
- Specified by:
- getAttributeNS in interface Element
public Attr getAttributeNode(String name)
DOM L1 Returns the appropriate attribute node; the name is the nodeName property of the attribute.
- Specified by:
- getAttributeNode in interface Element
public Attr getAttributeNodeNS(String namespace, String localPart)
DOM L2 Returns the appropriate attribute node; the name combines the namespace name and the local part.
- Specified by:
- getAttributeNodeNS in interface Element
public NamedNodeMap getAttributes()
DOM L1 Returns the element's attributes
- Specified by:
- getAttributes in interface Node
- Overrides:
- getAttributes in interface DomNode
public String getBaseURI()
The absolute base URI of this node ornull
if the implementation wasn't able to obtain an absolute URI. This value is computed as described in . However, when theDocument
supports 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 thedocumentURI
attribute from theDocument
interface otherwise.
- Specified by:
- getBaseURI in interface Node
- Overrides:
- getBaseURI in interface DomNode
- Since:
- DOM Level 3
public TypeInfo getSchemaTypeInfo()
The type information associated with this element.
- Specified by:
- getSchemaTypeInfo in interface Element
- Since:
- DOM Level 3
public final String getTagName()
DOM L1 Returns the element name (same as getNodeName).
- Specified by:
- getTagName in interface Element
public boolean hasAttribute(String name)
DOM L2 Returns true if the element has an attribute with the specified name (specified or DTD defaulted).
- Specified by:
- hasAttribute in interface Element
public boolean hasAttributeNS(String namespaceURI, String local)
DOM L2 Returns true if the element has an attribute with the specified name (specified or DTD defaulted).
- Specified by:
- hasAttributeNS in interface Element
public boolean hasAttributes()
DOM L2> Returns true iff this is an element node with attributes.
- Specified by:
- hasAttributes in interface Node
- Overrides:
- hasAttributes in interface DomNode
public boolean isDefaultNamespace(String namespaceURI)
This method checks if the specifiednamespaceURI
is the default namespace or not.
- Specified by:
- isDefaultNamespace in interface Node
- Overrides:
- isDefaultNamespace in interface DomNode
- Parameters:
namespaceURI
- The namespace URI to look for.
- Returns:
- Returns
true
if the specifiednamespaceURI
is the default namespace,false
otherwise.
- Since:
- DOM Level 3
public String lookupNamespaceURI(String prefix)
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:
- lookupNamespaceURI in interface Node
- Overrides:
- lookupNamespaceURI in interface DomNode
- Parameters:
prefix
- The prefix to look for. If this parameter isnull
, the method will return the default namespace URI if any.
- Returns:
- Returns the associated namespace URI or
null
if none is found.
- Since:
- DOM Level 3
public String lookupPrefix(String namespaceURI)
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:
- lookupPrefix in interface Node
- Overrides:
- lookupPrefix in interface DomNode
- Parameters:
namespaceURI
- The namespace URI to look for.
- Returns:
- Returns an associated namespace prefix if found or
null
if none is found. If more than one prefix are associated to the namespace prefix, the returned namespace prefix is implementation dependent.
- Since:
- DOM Level 3
public void makeReadonly()
Marks this element, its children, and its associated attributes as readonly.
- Overrides:
- makeReadonly in interface DomNode
public void removeAttribute(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:
- removeAttribute in interface Element
public void removeAttributeNS(String namespace, 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:
- removeAttributeNS in interface Element
public Attr removeAttributeNode(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:
- removeAttributeNode in interface Element
public void setAttribute(String name, 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:
- setAttribute in interface Element
public void setAttributeNS(String uri, String aname, String value)
DOM L2 Modifies an existing attribute to have the specified value, or creates a new one with that value.
- Specified by:
- setAttributeNS in interface Element
public Attr setAttributeNode(Attr attr)
DOM L1 Stores the specified attribute, optionally overwriting any existing one with that name.
- Specified by:
- setAttributeNode in interface Element
public Attr setAttributeNodeNS(Attr attr)
DOM L2 Stores the specified attribute, optionally overwriting any existing one with that name.
- Specified by:
- setAttributeNodeNS in interface Element
public void setIdAttribute(String name, boolean isId)
If the parameterisId
istrue
, this method declares the specified attribute to be a user-determined ID attribute . This affects the value ofAttr.isId
and the behavior ofDocument.getElementById
, but does not change any schema that may be in use, in particular this does not affect theAttr.schemaTypeInfo
of the specifiedAttr
node. Use the valuefalse
for the parameterisId
to undeclare an attribute for being a user-determined ID attribute.
To specify an attribute by local name and namespace URI, use thesetIdAttributeNS
method.
- Specified by:
- setIdAttribute in interface Element
- Parameters:
name
- The name of the attribute.isId
- Whether the attribute is a of type ID.
- Since:
- DOM Level 3
public void setIdAttributeNS(String namespaceURI, String localName, boolean isId)
If the parameterisId
istrue
, this method declares the specified attribute to be a user-determined ID attribute . This affects the value ofAttr.isId
and the behavior ofDocument.getElementById
, but does not change any schema that may be in use, in particular this does not affect theAttr.schemaTypeInfo
of the specifiedAttr
node. Use the valuefalse
for the parameterisId
to undeclare an attribute for being a user-determined ID attribute.
- Specified by:
- setIdAttributeNS in interface Element
- Parameters:
namespaceURI
- The namespace URI of the attribute.localName
- The local name of the attribute.isId
- Whether the attribute is a of type ID.
- Since:
- DOM Level 3
public void setIdAttributeNode(Attr attr, boolean isId)
If the parameterisId
istrue
, this method declares the specified attribute to be a user-determined ID attribute . This affects the value ofAttr.isId
and the behavior ofDocument.getElementById
, but does not change any schema that may be in use, in particular this does not affect theAttr.schemaTypeInfo
of the specifiedAttr
node. Use the valuefalse
for the parameterisId
to undeclare an attribute for being a user-determined ID attribute.
- Specified by:
- setIdAttributeNode in interface Element
- Parameters:
isId
- Whether the attribute is a of type ID.
- Since:
- DOM Level 3