All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----oracle.xml.parser.XMLNode | +----oracle.xml.parser.XMLElement
Element
interface.
Elements are created by the XML parser using the default NodeFactory or
the user defined NodeFactory if registered using setNodeFactoty() method.
Attr
node by name.
NamedNodeMap
containing the attributes of this node (if it
is an Element
) or null
otherwise.
NodeList
of all immediate children with a given
tag name,
NodeList
of all descendant elements with a given
tag name, in the order in which they would be encountered in a preorder
traversal of the Element
tree.
Text
nodes in the full depth of the sub-tree
underneath this Element
into a "normal" form where only
markup (e.g., tags, comments, processing instructions, CDATA sections,
and entity references) separates Text
nodes, i.e., there
are no adjacent Text
nodes.
public XMLElement(String tag)
public String getTagName()
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.
public String getQualifiedName()
public String getNamespace()
public String getLocalName()
public String getExpandedName()
public String getAttribute(String name)
Attr
value as a string, or the empty string if
that attribute does not have a specified or default value.
public void setAttribute(String name, String value) throws DOMException
Attr
node plus any Text
and
EntityReference
nodes, build the appropriate subtree, and
use setAttributeNode
to assign it as the value of an
attribute.
public void removeAttribute(String name) throws DOMException
public Attr getAttributeNode(String name)
Attr
node by name.
Attr
node with the specified attribute name or
null
if there is no such attribute.
public Attr setAttributeNode(Attr newAttr) throws DOMException
Attr
node to add to the attribute list.
newAttr
attribute replaces an existing
attribute with the same name, the previously existing
Attr
node is returned, otherwise null
is
returned.
newAttr
was created from a
different document than the one that created the element.
newAttr
is already an
attribute of another Element
object. The DOM user must
explicitly clone Attr
nodes to re-use them in other
elements.
public Attr removeAttributeNode(Attr oldAttr) throws DOMException
Attr
node to remove from the attribute
list. If the removed Attr
has a default value it is
immediately replaced.
Attr
node that was removed.
oldAttr
is not an attribute
of the element.
public NodeList getChildrenByTagName(String name)
NodeList
of all immediate children with a given
tag name,
public NodeList getElementsByTagName(String name)
NodeList
of all descendant elements with a given
tag name, in the order in which they would be encountered in a preorder
traversal of the Element
tree.
Element
nodes.
public void normalize()
Text
nodes in the full depth of the sub-tree
underneath this Element
into a "normal" form where only
markup (e.g., tags, comments, processing instructions, CDATA sections,
and entity references) separates Text
nodes, i.e., there
are no adjacent Text
nodes. This can be used to ensure
that the DOM view of a document is the same as if it were saved and
re-loaded, and is useful when operations (such as XPointer lookups) that
depend on a particular doc1ument tree structure are to be used.
public NamedNodeMap getAttributes()
NamedNodeMap
containing the attributes of this node (if it
is an Element
) or null
otherwise.
public Node cloneNode(boolean deep)
parentNode
returns null
.).
Element
copies all attributes and their
values, including those generated by the XML processor to represent
defaulted attributes, but this method does not copy any text it contains
unless it is a deep clone, since the text is contained in a child
Text
node. Cloning any other type of node simply returns a
copy of this node.
true
, recursively clone the subtree under the
specified node; if false
, clone only the node itself (and
its attributes, if it is an Element
).
All Packages Class Hierarchy This Package Previous Next Index