Skip navigation links

Oracle® Database XML Java API Reference 11g Release 2 (11.2) E10769-01

## oracle.xml.parser.v2
Class XMLElement

`java.lang.Object
oracle.xml.parser.v2.XMLNode
oracle.xml.parser.v2.XMLNSNode
oracle.xml.parser.v2.XMLElement`

All Implemented Interfaces:
  java.io.Externalizable, java.io.Serializable, java.lang.Cloneable, NSResolver, NSName, Element, EventTarget, Node, ElementEditVAL, NodeEditVAL

Direct Known Subclasses:
  XMLDocument, XMLDocumentFragment

      public class XMLElement

extends XMLNSNode
implements Element, NSName, NSResolver, ElementEditVAL, java.io.Externalizable

This class implements the DOM `Element` Interface

See Also:
  Serialized Form

Field Summary
`static short` `ANY_CONTENTTYPE`
`static short` `ELEMENTS_CONTENTTYPE`
`static short` `EMPTY_CONTENTTYPE`
`static short` `MIXED_CONTENTTYPE`

Fields inherited from class oracle.xml.parser.v2.XMLNode

`ATTRDECL, Auto_Events, capturing, DOMAttrModified, DOMCharacterDataModified, DOMNodeInserted, DOMNodeInsertedIntoDocument, DOMNodeRemoved, DOMNodeRemovedFromDocument, DOMSubtreeModified, ELEMENTDECL, KEPT_NODE, NAMESPACE_NODE, noncapturing, RANGE_DELETE_EVENT, RANGE_DELETETEXT_EVENT, RANGE_INSERT_EVENT, RANGE_INSERTTEXT_EVENT, RANGE_REPLACE_EVENT, RANGE_SETTEXT_EVENT, SCHEMA_NILLED, TRAVERSAL_DELETE_EVENT, TRAVERSAL_REPLACE_EVENT, XMLDECL_NODE`

Fields inherited from interface org.w3c.dom.Node
`ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE`

Fields inherited from interface org.w3c.dom.validation.ElementEditVAL
`VAL_ANY_CONTENTTYPE, VAL_ELEMENTS_CONTENTTYPE, VAL_EMPTY_CONTENTTYPE, VAL_MIXED_CONTENTTYPE, VAL_SIMPLE_CONTENTTYPE`

Fields inherited from interface org.w3c.dom.validation.NodeEditVAL
`VAL_FALSE, VAL_INCOMPLETE, VAL_NS_WF, VAL_SCHEMA, VAL_TRUE, VAL_UNKNOWN, VAL_WF`

Constructor Summary
`protected` `XMLElement(XMLDocument doc)` Protected constructor used to create custom DOM Node using XMLDocument as the factory.
`protected` `XMLElement(XMLDocument doc, java.lang.String namespace, java.lang.String qname)` Protected constructor used to create custom DOM Node using XMLDocument as the factory.

Method Summary
`short` `canAppendChild(Node newChild)` Determines whether the `Node.appendChild` operation would make this document not compliant with the `VAL_INCOMPLETE` validity type.
`short` `canInsertBefore(Node newChild, Node refChild)` Determines whether the `Node.insertBefore` operation would make this document not compliant with the `VAL_INCOMPLETE` validity type.
`short` `canRemoveAttribute(java.lang.String attrname)` Verifies if an attribute by the given name can be removed.
`short` `canRemoveAttributeNode(Node attrNode)` Determines if an attribute node can be removed.
`short` `canRemoveAttributeNS(java.lang.String namespaceURI, java.lang.String localName)` Verifies if an attribute by the given local name and namespace can be removed.
`short` `canRemoveChild(Node oldChild)` Determines whether the `Node.removeChild` operation would make this document not compliant with the `VAL_INCOMPLETE` validity type.
`short` `canReplaceChild(Node newChild, Node oldChild)` Determines whether the `Node.replaceChild` operation would make this document not compliant with the `VAL_INCOMPLETE` validity type.
`short` `canSetAttribute(java.lang.String attrname, java.lang.String attrval)` Determines if the value for specified attribute can be set.
`short` `canSetAttributeNode(Attr attrNode)` Determines if an attribute node can be added.
`short` `canSetAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName, java.lang.String value)` Determines if the attribute with given namespace and qualified name can be created if not already present in the attribute list of the element.
`short` `canSetTextContent(java.lang.String possibleTextContent)` Determines if the text content of this node and its descendants can be set to the string passed in.
`NameList` `getAllowedAttributes()` A `NameList`, as described in [DOM Level 3 Core] , of all possible attribute information items or wildcards that can appear as attributes of this element, or `null` if this element has no context or schema.
`NameList` `getAllowedChildren()` A `NameList`, as described in [ DOM Level 3 Core], of all possible element information items or wildcards that can appear as children of this element, or `null` if this element has no context or schema.
`NameList` `getAllowedFirstChildren()` A `NameList`, as described in [ DOM Level 3 Core] , of all possible element information items or wildcards that can appear as a first child of this element, or `null` if this element has no context or schema.
`NameList` `getAllowedNextSiblings()` A `NameList`, as described in [ DOM Level 3 Core] , of all possible element information items or wildcards that can appear as a next sibling of this element, or `null` if this element has no context or schema.
`NameList` `getAllowedParents()` A `NameList`, as described in [ DOM Level 3 Core] , of all possible element information items that can appear as a parent this element, or `null` if this element has no context or schema.
`NameList` `getAllowedPreviousSiblings()` A `NameList`, as described in [ DOM Level 3 Core] , of all possible element information items or wildcards that can appear as a previous sibling of this element, or `null` if this element has no context or schema.
`java.lang.String` `getAttribute(java.lang.String name)` Retrieves an attribute value by name.
`Attr` `getAttributeNode(java.lang.String name)` Retrieves an `Attr` node by name.
`Attr` `getAttributeNode(java.lang.String name, java.lang.String namespace)` Deprecated. As of DOM 2
`Attr` `getAttributeNodeNS(java.lang.String namespaceURI, java.lang.String localName)` Retrieves an Attr node by local name and namespace URI.
`java.lang.String` `getAttributeNS(java.lang.String namespaceURI, java.lang.String localName)` Retrieves an attribute value by local name and namespace URI.
`NamedNodeMap` `getAttributes()` A `NamedNodeMap` containing the attributes of this node (if it is an `Element`) or `null` otherwise.
`NodeList` `getChildrenByTagName(java.lang.String name)` Returns a `NodeList` of all immediate children with a given tag name,
`NodeList` `getChildrenByTagName(java.lang.String name, java.lang.String ns)` Returns a `NodeList` of all immediate children with a given tag name and namespace
`short` `getContentType()` The content type of an element.
`java.lang.String` `getDefaultValue()` The default value specified in an attribute or an element declaration or `null` if unspecified.
`NodeList` `getElementsByTagName(java.lang.String name)` Returns a `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.
`NodeList` `getElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String localName)` Returns a NodeList of all the descendant Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of this Element tree.
`DOMStringList` `getEnumeratedValues()` A `DOMStringList`, as described in [DOM Level 3 Core] , of distinct values for an attribute or an element declaration or `null` if unspecified.
`java.lang.String` `getExpandedName()` Get the fully resolved name for this element.
`XMLNode` `getFirstAttribute()` Retrieves the first `Attr`.
`java.lang.String` `getLocalName()` Gets the Local Name of this node
`java.lang.String` `getNamespaceURI()` Gets the namespace URI of this node.
`XMLElement` `getNextSiblingByName()`
`java.lang.String` `getNodeName()` Gets the name of this node, depending on its type
`short` `getNodeType()` Gets a code representing the type of the underlying object
`java.lang.String` `getPrefix()` Get the namespace prefix for this element.
`java.lang.String` `getQualifiedName()` Deprecated. - Use getNodeName
`NameList` `getRequiredAttributes()` A `NameList`, as described in [ DOM Level 3 Core], of required attribute information items that must appear on this element, or `null` if this element has no context or schema.
`java.lang.String` `getTagName()` Gets the name of the element.
`boolean` `hasAttribute(java.lang.String name)` Returns true when an attribute with a given name is specified on this element or has a default value, false otherwise.
`boolean` `hasAttributeNS(java.lang.String namespaceURI, java.lang.String localName)` Returns true when an attribute with a given local name and namespace URI is specified on this element or has a default value,false otherwise
`boolean` `hasAttributes()` Returns whether this node (if it is an element) has any attributes.
`short` `isElementDefined(java.lang.String name)` Determines if `name` is defined in the schema.
`short` `isElementDefinedNS(java.lang.String namespaceURI, java.lang.String name)` Determines if `name` in this namespace is defined in the current context.
`short` `nodeValidity(short wFValidityCheckLevel)` Determines if the node is valid relative to the validation type specified in `valType`.
`void` `normalize()` Deprecated. As of DOM 2
`void` `removeAttribute(java.lang.String name)` Removes an attribute by name.
`Attr` `removeAttributeNode(Attr attr)` Removes the specified attribute.
`void` `removeAttributeNS(java.lang.String namespaceURI, java.lang.String localName)` Removes an attribute by local name and namespace URI.
`void` `reportSAXEvents(ContentHandler cntHandler)` Report SAX Events from a DOM Tree
`java.lang.String` `resolveNamespacePrefix(java.lang.String prefix)` Given a namespace prefix, find the namespace definition in scope in this element.
`void` `setAttribute(java.lang.String name, java.lang.String value)` Adds a new attribute.
`Attr` `setAttributeNode(Attr attr)` Adds a new attribute.
`Attr` `setAttributeNodeNS(Attr newAttr)` Adds a new attribute.
`void` `setAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName, java.lang.String value)` Adds a new attribute.
`void` `setPrefix(java.lang.String prefix)` Sets the prefix of this node
`boolean` `validateContent(DTD dtd)` Validates the content of a element node.
`boolean` `validateContent(XMLSchema schema)` Validates the content of the element against given XML Schema
`boolean` `validateContent(XMLSchema schema, java.lang.String mode)` Validates the content of the element against given XML Schema in the given mode.
`XMLNode` `validateContent(XSDValidator validator, boolean flag)` Validates the content of the element using given validator

Methods inherited from class oracle.xml.parser.v2.XMLNSNode
`addText, addText, appendChild, getChildNodes, getFirstChild, getLastChild, getText, insertBefore, removeChild, replaceChild`

Methods inherited from class oracle.xml.parser.v2.XMLNode

`addEventListener, cloneNode, dispatchEvent, equals, getColumnNumber, getDebugMode, getFirstChildAsOffset, getLineNumber, getNextSibling, getNextSiblingAsOffset, getNodeValue, getNodeValueAsBinaryStream, getNodeValueAsBinaryStream, getNodeValueAsCharacterStream, getNodeValueAsCharacterStream, getOwnerDocument, getParentNode, getPreviousSibling, getPrimitiveTypeId, getProperty, getSystemId, getXMLError, hasChildNodes, hashCode, isDocumentFlag, isNodeFlag, isSupported, print, print, print, print, readExternal, removeEventListener, resetNodeFlag, selectNodes, selectNodes, selectSingleNode, selectSingleNode, setDebugInfo, setNodeFlag, setNodeFlag, setNodeFlag, setNodeValue, setNodeValueAsBinaryStream, setNodeValueAsBinaryStream, setNodeValueAsCharacterStream, setNodeValueAsCharacterStream, setProperty, transformNode, valueOf, valueOf, writeExternal, xdbGetNodeId`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.w3c.dom.Node
`appendChild, cloneNode, getChildNodes, getFirstChild, getLastChild, getNextSibling, getNodeValue, getOwnerDocument, getParentNode, getPreviousSibling, hasChildNodes, insertBefore, isSupported, removeChild, replaceChild, setNodeValue`

Methods inherited from interface oracle.xml.util.NSName
`getNamespace`

Methods inherited from interface org.w3c.dom.validation.ElementEditVAL
`getAllowedFirstChildElements`

Methods inherited from interface java.io.Externalizable
`readExternal, writeExternal`

Field Detail

### EMPTY_CONTENTTYPE

    public static final short EMPTY_CONTENTTYPE

  See Also:
    Constant Field Values

### ANY_CONTENTTYPE

    public static final short ANY_CONTENTTYPE

  See Also:
    Constant Field Values

### MIXED_CONTENTTYPE

    public static final short MIXED_CONTENTTYPE

  See Also:
    Constant Field Values

### ELEMENTS_CONTENTTYPE

    public static final short ELEMENTS_CONTENTTYPE

  See Also:
    Constant Field Values

Constructor Detail

### XMLElement

    protected XMLElement(XMLDocument doc)

  Protected constructor used to create custom DOM Node using XMLDocument as the factory. See method XMLDocument.createNodeFromType for details.
  Parameters:
    `doc` - - Owner document

### XMLElement

    protected XMLElement(XMLDocument doc,
                         java.lang.String namespace,
                         java.lang.String qname)

  Protected constructor used to create custom DOM Node using XMLDocument as the factory. See method XMLDocument.createNodeFromType for details.
  Parameters:
    `doc` - - Owner document
    `namespace` - Namespace of the element
    `qname` - Qname of the element

Method Detail

### getNodeType

    public short getNodeType()

  Gets a code representing the type of the underlying object
  Specified by:
    `getNodeType` in interface `Node`
  Overrides:
    `getNodeType` in class `XMLNode`
  Returns:
    type of the node

### getNodeName

    public java.lang.String getNodeName()

  Gets the name of this node, depending on its type
  Specified by:
    `getNodeName` in interface `Node`
  Overrides:
    `getNodeName` in class `XMLNode`
  Returns:
    Name of this node

### getTagName

    public java.lang.String getTagName()

  Gets the name of the element.
  Specified by:
    `getTagName` in interface `Element`
  Returns:
    The element name

### getLocalName

    public java.lang.String getLocalName()

  Gets the Local Name of this node
  Specified by:
    `getLocalName` in interface `NSName`
  Specified by:
    `getLocalName` in interface `Node`
  Overrides:
    `getLocalName` in class `XMLNode`
  Returns:
    LocalName of the node

### getNamespaceURI

    public java.lang.String getNamespaceURI()

  Gets the namespace URI of this node.
  Specified by:
    `getNamespaceURI` in interface `Node`
  Overrides:
    `getNamespaceURI` in class `XMLNode`
  Returns:
    the namespace

### getPrefix

    public java.lang.String getPrefix()

  Get the namespace prefix for this element.
  Specified by:
    `getPrefix` in interface `NSName`
  Specified by:
    `getPrefix` in interface `Node`
  Overrides:
    `getPrefix` in class `XMLNode`
  Returns:
    the namespace prefix

### setPrefix

    public void setPrefix(java.lang.String prefix)
                   throws DOMException

  Sets the prefix of this node
  Specified by:
    `setPrefix` in interface `Node`
  Overrides:
    `setPrefix` in class `XMLNode`
  Parameters:
    `prefix` - set the prefix
  Throws:
    `DOMException` - if any DOM Exception occurs

### getAttributes

    public NamedNodeMap getAttributes()

  A `NamedNodeMap` containing the attributes of this node (if it is an `Element`) or `null` otherwise.
  Specified by:
    `getAttributes` in interface `Node`
  Overrides:
    `getAttributes` in class `XMLNode`
  Returns:
    The list of attributes of this element

### normalize

    public void normalize()

  Deprecated. As of DOM 2
  Puts all `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.
  Specified by:
    `normalize` in interface `Node`
  Overrides:
    `normalize` in class `XMLNSNode`
  See Also:
    `XMLNode.normalize()`

### hasAttribute

    public boolean hasAttribute(java.lang.String name)

  Returns true when an attribute with a given name is specified on this element or has a default value, false otherwise.
  Specified by:
    `hasAttribute` in interface `Element`
  Parameters:
    `String` - name of the attribute whose presence is checked
  Returns:
    true if the attribute whith the specified name is present, else null
  Since:
    DOM 2

### hasAttributeNS

    public boolean hasAttributeNS(java.lang.String namespaceURI,
                                  java.lang.String localName)

  Returns true when an attribute with a given local name and namespace URI is specified on this element or has a default value,false otherwise
  Specified by:
    `hasAttributeNS` in interface `Element`
  Parameters:
    `String` - namespaceURI,String localName of the attribute whose presence is checked
  Returns:
    true when an attribute with a given local name and namespace URI is specified on this element or has a default value,false otherwise
  Since:
    DOM 2

### hasAttributes

    public boolean hasAttributes()

  Returns whether this node (if it is an element) has any attributes.
  Specified by:
    `hasAttributes` in interface `Node`
  Overrides:
    `hasAttributes` in class `XMLNode`
  Returns:
    `true` if this node has any attributes, `false` otherwise.
  Since:
    DOM Level 2

### getAttribute

    public java.lang.String getAttribute(java.lang.String name)

  Retrieves an attribute value by name.
  Specified by:
    `getAttribute` in interface `Element`
  Parameters:
    `name` - The name of the attribute to retrieve.
  Returns:
    The `Attr` value as a string, or the empty string if that attribute does not have a specified or default value.

### setAttribute

    public void setAttribute(java.lang.String name,
                             java.lang.String value)
                      throws DOMException

  Adds a new attribute. If an attribute with that name is already present in the element, its value is changed to be that of 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 `setAttributeNode` to assign it as the value of an attribute. This method is namespace unaware and hence wont result in update of namespace table if a new attr is added thru this method
  Specified by:
    `setAttribute` in interface `Element`
  Parameters:
    `name` - The name of the attribute to create or alter.
    `value` - Value to set in string form.
  Throws:
    `DOMException` - INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.
    NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

### removeAttribute

    public void removeAttribute(java.lang.String name)
                         throws DOMException

  Removes an attribute by name. If the removed attribute has a default value it is immediately replaced.
  Specified by:
    `removeAttribute` in interface `Element`
  Parameters:
    `name` - The name of the attribute to remove.
  Throws:
    `DOMException` - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

### getAttributeNS

    public java.lang.String getAttributeNS(java.lang.String namespaceURI,
                                           java.lang.String localName)

  Retrieves an attribute value by local name and namespace URI.
  Specified by:
    `getAttributeNS` in interface `Element`
  Parameters:
    `namespaceURI` - namespace of the attribute requested
    `localName` - local name of the attribute requested
  Returns:
    the value of the attribute with the above mentioned namespace URI and localName if it exists ,else null.
  Since:
    DOM 2

### setAttributeNS

    public void setAttributeNS(java.lang.String namespaceURI,
                               java.lang.String qualifiedName,
                               java.lang.String value)
                        throws DOMException

  Adds a new attribute. 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.
  Specified by:
    `setAttributeNS` in interface `Element`
  Parameters:
    `namespaceURI` - namespace of the attribute to be added
    `qualifiedName` - qualified name of the attribute to be added
    `value` - value of the attribute to be added
  Throws:
    `DOMException` - INVALID_CHARACTER_ERR: Raised if the specified qualified name contains illegal Characters NAMESPACE_ERR : Raised if the qualified name is malformed if the qualified name has a prefix and the namespace URI is null or an empty string,or if the qulaifiedName is "xmlns" and namespace URI is different from "http://www.w3.org/2000/xmlns/" ,or if qualifiedName has a prefix that is "xml" and the namespaceURI is different from http://www.w3.org/XML/1998/namespaces NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly
  Since:
    DOM 2

### removeAttributeNS

    public void removeAttributeNS(java.lang.String namespaceURI,
                                  java.lang.String localName)
                           throws DOMException

  Removes an attribute by local name and namespace URI.
  Specified by:
    `removeAttributeNS` in interface `Element`
  Parameters:
    `String` - namespaceURI ,String localName of the attribute to be removed
  Throws:
    `DOMEXception` - NO_MODIFICATIONS_ALLOWED_ERR : if this element is readonly
    `DOMException` - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
  Since:
    DOM 2

### getAttributeNode

    public Attr getAttributeNode(java.lang.String name)

  Retrieves an `Attr` node by name.
  Specified by:
    `getAttributeNode` in interface `Element`
  Parameters:
    `name` - The name of the attribute to retrieve.
  Returns:
    The `Attr` node with the specified attribute name or `null` if there is no such attribute.

### setAttributeNode

    public Attr setAttributeNode(Attr attr)
                          throws DOMException

  Adds a new attribute. If an attribute with that name is already present in the element, it is replaced by the new one.
  Specified by:
    `setAttributeNode` in interface `Element`
  Parameters:
    `newAttr` - The `Attr` node to add to the attribute list.
  Returns:
    If the `newAttr` attribute replaces an existing attribute with the same name, the previously existing `Attr` node is returned, otherwise `null` is returned.
  Throws:
    `DOMException` - 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.

### removeAttributeNode

    public Attr removeAttributeNode(Attr attr)
                             throws DOMException

  Removes the specified attribute.
  Specified by:
    `removeAttributeNode` in interface `Element`
  Parameters:
    `oldAttr` - The `Attr` node to remove from the attribute list. If the removed `Attr` has a default value it is immediately replaced.
  Returns:
    The `Attr` node that was removed.
  Throws:
    `DOMException` - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
    NOT_FOUND_ERR: Raised if `oldAttr` is not an attribute of the element.

### getAttributeNodeNS

    public Attr getAttributeNodeNS(java.lang.String namespaceURI,
                                   java.lang.String localName)

  Retrieves an Attr node by local name and namespace URI.
  Specified by:
    `getAttributeNodeNS` in interface `Element`
  Parameters:
    `namespaceURI` - namespace URI
    `localName` - the attribute to be retrieved
  Returns:
    Attribute with the given namespaceURI and localName if it exists, else null.
  Since:
    DOM 2

### setAttributeNodeNS

    public Attr setAttributeNodeNS(Attr newAttr)
                            throws DOMException

  Adds a new attribute. If an attribute with that local name and that namespace URI is already present in the element, it is replaced by the new one.
  Specified by:
    `setAttributeNodeNS` in interface `Element`
  Parameters:
    `newAttr` - node to be added
  Returns:
    the Attribute Node added
  Throws:
    `DOMException` - WRONG_DOCUMENT_ERR : raised if the newAttr was created from a document different from the one that created the document NO_MODIFICATIONS_ALLOWED_ERR :Raised if this element is readonly INUSE_ATTRIBUTE_ERR : Raised if newAttr is already an attribute of another Element object
  Since:
    DOM 2

### getElementsByTagName

    public NodeList getElementsByTagName(java.lang.String name)

  Returns a `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.
  Specified by:
    `getElementsByTagName` in interface `Element`
  Parameters:
    `name` - The name of the tag to match on. The special value "*" matches all tags.
  Returns:
    A list of matching `Element` nodes.

### getElementsByTagNameNS

    public NodeList getElementsByTagNameNS(java.lang.String namespaceURI,
                                           java.lang.String localName)

  Returns a NodeList of all the descendant Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of this Element tree.
  Specified by:
    `getElementsByTagNameNS` in interface `Element`
  Parameters:
    `namespaceURI` - the namespace of the element
    `localName` - the local name of the element
  Returns:
    A new `NodeList` object containing all the matched `Elements`.
  Since:
    DOM 2

### getDefaultValue

    public java.lang.String getDefaultValue()

  The default value specified in an attribute or an element declaration or `null` if unspecified. Elena wanted mention of XML Schema's canonical lexical representation here. Why?
  Specified by:
    `getDefaultValue` in interface `NodeEditVAL`
  Overrides:
    `getDefaultValue` in class `XMLNode`

### getEnumeratedValues

    public DOMStringList getEnumeratedValues()

  A `DOMStringList`, as described in [DOM Level 3 Core] , of distinct values for an attribute or an element declaration or `null` if unspecified. If the schema is a W3C XML schema, this is a list of strings which are lexical representations corresponding to the values in the [value] property of the enumeration component for the type of the attribute or element. It is recommended that the canonical lexical representations of the values be used.
  Specified by:
    `getEnumeratedValues` in interface `NodeEditVAL`
  Overrides:
    `getEnumeratedValues` in class `XMLNode`

### canInsertBefore

    public short canInsertBefore(Node newChild,
                                 Node refChild)

  Determines whether the `Node.insertBefore` operation would make this document not compliant with the `VAL_INCOMPLETE` validity type.
  Specified by:
    `canInsertBefore` in interface `NodeEditVAL`
  Overrides:
    `canInsertBefore` in class `XMLNode`
  Parameters:
    `newChild` - `Node` to be inserted.
    `refChild` - Reference `Node`.
  Returns:
    A validation state constant.

### canRemoveChild

    public short canRemoveChild(Node oldChild)

  Determines whether the `Node.removeChild` operation would make this document not compliant with the `VAL_INCOMPLETE` validity type.
  Specified by:
    `canRemoveChild` in interface `NodeEditVAL`
  Overrides:
    `canRemoveChild` in class `XMLNode`
  Parameters:
    `oldChild` - `Node` to be removed.
  Returns:
    A validation state constant.

### canReplaceChild

    public short canReplaceChild(Node newChild,
                                 Node oldChild)

  Determines whether the `Node.replaceChild` operation would make this document not compliant with the `VAL_INCOMPLETE` validity type.
  Specified by:
    `canReplaceChild` in interface `NodeEditVAL`
  Overrides:
    `canReplaceChild` in class `XMLNode`
  Parameters:
    `newChild` - New `Node`.
    `oldChild` - `Node` to be replaced.
  Returns:
    A validation state constant.

### canAppendChild

    public short canAppendChild(Node newChild)

  Determines whether the `Node.appendChild` operation would make this document not compliant with the `VAL_INCOMPLETE` validity type.
  Specified by:
    `canAppendChild` in interface `NodeEditVAL`
  Overrides:
    `canAppendChild` in class `XMLNode`
  Parameters:
    `newChild` - `Node` to be appended.
  Returns:
    A validation state constant.

### nodeValidity

    public short nodeValidity(short wFValidityCheckLevel)

  Determines if the node is valid relative to the validation type specified in `valType`. This operation doesn't normalize before checking if it is valid. To do so, one would need to explicitly call a normalize method. The difference between this method and the `validateDocument` method on the `DocumentVAL` interface is that `validateDocument` only checks to determine whether the entire document is valid.
  Specified by:
    `nodeValidity` in interface `NodeEditVAL`
  Overrides:
    `nodeValidity` in class `XMLNode`
  Parameters:
    `wFValidityCheckLevel` - Flag to tell at what level validity and well-formedness checking is done.
  Returns:
    A validation state constant.

### getAllowedChildren

    public NameList getAllowedChildren()

  A `NameList`, as described in [ DOM Level 3 Core], of all possible element information items or wildcards that can appear as children of this element, or `null` if this element has no context or schema. Duplicate pairs of {namespaceURI, name} are eliminated.
  Specified by:
    `getAllowedChildren` in interface `ElementEditVAL`

### getAllowedFirstChildren

    public NameList getAllowedFirstChildren()

  A `NameList`, as described in [ DOM Level 3 Core] , of all possible element information items or wildcards that can appear as a first child of this element, or `null` if this element has no context or schema. Duplicate pairs of {namespaceURI, name} are eliminated.

### getAllowedParents

    public NameList getAllowedParents()

  A `NameList`, as described in [ DOM Level 3 Core] , of all possible element information items that can appear as a parent this element, or `null` if this element has no context or schema.
  Specified by:
    `getAllowedParents` in interface `ElementEditVAL`

### getAllowedNextSiblings

    public NameList getAllowedNextSiblings()

  A `NameList`, as described in [ DOM Level 3 Core] , of all possible element information items or wildcards that can appear as a next sibling of this element, or `null` if this element has no context or schema. Duplicate pairs of {namespaceURI, name} are eliminated.
  Specified by:
    `getAllowedNextSiblings` in interface `ElementEditVAL`

### getAllowedPreviousSiblings

    public NameList getAllowedPreviousSiblings()

  A `NameList`, as described in [ DOM Level 3 Core] , of all possible element information items or wildcards that can appear as a previous sibling of this element, or `null` if this element has no context or schema.
  Specified by:
    `getAllowedPreviousSiblings` in interface `ElementEditVAL`

### getAllowedAttributes

    public NameList getAllowedAttributes()

  Description copied from interface: `ElementEditVAL`
  A `NameList`, as described in [DOM Level 3 Core] , of all possible attribute information items or wildcards that can appear as attributes of this element, or `null` if this element has no context or schema. Duplicate pairs of {namespaceURI, name} are eliminated.
  Specified by:
    `getAllowedAttributes` in interface `ElementEditVAL`

### getRequiredAttributes

    public NameList getRequiredAttributes()

  A `NameList`, as described in [ DOM Level 3 Core], of required attribute information items that must appear on this element, or `null` if this element has no context or schema. Duplicate pairs of {namespaceURI, name} are eliminated.
  Specified by:
    `getRequiredAttributes` in interface `ElementEditVAL`

### getContentType

    public short getContentType()

  The content type of an element.
  Specified by:
    `getContentType` in interface `ElementEditVAL`

### canSetAttribute

    public short canSetAttribute(java.lang.String attrname,
                                 java.lang.String attrval)

  Determines if the value for specified attribute can be set.
  Specified by:
    `canSetAttribute` in interface `ElementEditVAL`
  Parameters:
    `attrname` - Name of attribute.
    `attrval` - Value to be assigned to the attribute.
  Returns:
    A validation state constant.

### canSetAttributeNode

    public short canSetAttributeNode(Attr attrNode)

  Determines if an attribute node can be added.
  Specified by:
    `canSetAttributeNode` in interface `ElementEditVAL`
  Parameters:
    `attrNode` - `Node` in which the attribute can possibly be set.
  Returns:
    A validation state constant.

### canSetAttributeNS

    public short canSetAttributeNS(java.lang.String namespaceURI,
                                   java.lang.String qualifiedName,
                                   java.lang.String value)

  Determines if the attribute with given namespace and qualified name can be created if not already present in the attribute list of the element. If the attribute with the same qualified name and namespaceURI is already present in the element's attribute list, it tests whether the value of the attribute and its prefix can be set to the new value. See DOM core `setAttributeNS`.
  Specified by:
    `canSetAttributeNS` in interface `ElementEditVAL`
  Parameters:
    `namespaceURI` - `namespaceURI` of namespace.
    `qualifiedName` - Qualified name of attribute.
    `value` - Value to be assigned to the attribute.
  Returns:
    A validation state constant.

### canRemoveAttribute

    public short canRemoveAttribute(java.lang.String attrname)

  Verifies if an attribute by the given name can be removed.
  Specified by:
    `canRemoveAttribute` in interface `ElementEditVAL`
  Parameters:
    `attrname` - Name of attribute.
  Returns:
    A validation state constant.

### canRemoveAttributeNS

    public short canRemoveAttributeNS(java.lang.String namespaceURI,
                                      java.lang.String localName)

  Verifies if an attribute by the given local name and namespace can be removed.
  Specified by:
    `canRemoveAttributeNS` in interface `ElementEditVAL`
  Parameters:
    `namespaceURI` - The namespace URI of the attribute to remove.
    `localName` - Local name of the attribute to be removed.
  Returns:
    A validation state constant.

### canRemoveAttributeNode

    public short canRemoveAttributeNode(Node attrNode)

  Determines if an attribute node can be removed.
  Specified by:
    `canRemoveAttributeNode` in interface `ElementEditVAL`
  Parameters:
    `attrNode` - The `Attr` node to remove from the attribute list.
  Returns:
    A validation state constant.

### canSetTextContent

    public short canSetTextContent(java.lang.String possibleTextContent)

  Determines if the text content of this node and its descendants can be set to the string passed in.
  Parameters:
    `possibleTextContent` - Possible text content string.
  Returns:
    A validation state constant.

### isElementDefined

    public short isElementDefined(java.lang.String name)

  Determines if `name` is defined in the schema. This only applies to global declarations.
  Specified by:
    `isElementDefined` in interface `ElementEditVAL`
  Parameters:
    `name` - Name of element.
  Returns:
    A validation state constant.

### isElementDefinedNS

    public short isElementDefinedNS(java.lang.String namespaceURI,
                                    java.lang.String name)

  Determines if `name` in this namespace is defined in the current context. Thus not only does this apply to global declarations . but depending on the content, this may also apply to local definitions.
  Specified by:
    `isElementDefinedNS` in interface `ElementEditVAL`
  Parameters:
    `namespaceURI` - `namespaceURI` of namespace.
    `name` - Name of element.
  Returns:
    A validation state constant.

### getExpandedName

    public java.lang.String getExpandedName()

  Get the fully resolved name for this element.
  Specified by:
    `getExpandedName` in interface `NSName`
  Returns:
    the fully resolved name

### getFirstAttribute

    public XMLNode getFirstAttribute()

  Retrieves the first `Attr`.
  Returns:
    The first `Attr` node `null` if there is no attribute.

### getNextSiblingByName

    public XMLElement getNextSiblingByName()

### resolveNamespacePrefix

    public java.lang.String resolveNamespacePrefix(java.lang.String prefix)

  Given a namespace prefix, find the namespace definition in scope in this element.
  Specified by:
    `resolveNamespacePrefix` in interface `NSResolver`
  Parameters:
    `prefix` - Namespace prefix to be resolved if the prefix == #default, return the default namespace
  Returns:
    the resolved Namespace (null, if prefix could not be resolved)

### getChildrenByTagName

    public NodeList getChildrenByTagName(java.lang.String name)

  Returns a `NodeList` of all immediate children with a given tag name,
  Parameters:
    `name` - The name of the tag to match on.
  Returns:
    A list of matching children

### getChildrenByTagName

    public NodeList getChildrenByTagName(java.lang.String name,
                                         java.lang.String ns)

  Returns a `NodeList` of all immediate children with a given tag name and namespace
  Parameters:
    `name` - The name of the tag to match on. (should be local name)
    `ns` - The name space
  Returns:
    A list of matching children

### reportSAXEvents

    public void reportSAXEvents(ContentHandler cntHandler)
                         throws SAXException

  Report SAX Events from a DOM Tree
  Overrides:
    `reportSAXEvents` in class `XMLNode`
  Parameters:
    `cntHandler` - ContentHandler
  Throws:
    `SAXException` - thrown by SAX Callback functions

### validateContent

    public boolean validateContent(DTD dtd)

  Validates the content of a element node.
  Returns:
    True if valid, else false

### validateContent

    public boolean validateContent(XMLSchema schema)
                            throws XMLParseException

  Validates the content of the element against given XML Schema
  Parameters:
    `schema` - schema used to validate
  Returns:
    True if valid, else false
  Throws:
    `XMLParseException`

### validateContent

    public XMLNode validateContent(XSDValidator validator,
                                   boolean flag)
                            throws XMLParseException

  Validates the content of the element using given validator
  Parameters:
    `schema` - validator used to validate
    `flag` - indicate if copy result or not
  Returns:
    this/a copy of this node with annotated psvi.
  Throws:
    `XMLParseException`

### validateContent

    public boolean validateContent(XMLSchema schema,
                                   java.lang.String mode)
                            throws XMLParseException

  Validates the content of the element against given XML Schema in the given mode.
  Parameters:
    `schem` - - schema used to validate the content
    `mode` - - the validation mode
  Returns:
    True if valid, else false
  Throws:
    `XMLParseException`

### getAttributeNode

    public Attr getAttributeNode(java.lang.String name,
                                 java.lang.String namespace)

  Deprecated. As of DOM 2
  See Also:
    `getAttributeNodeNS(String ,String)`

### getQualifiedName

    public java.lang.String getQualifiedName()

  Deprecated. - Use getNodeName
  Get the qualified name for this element.
  Specified by:
    `getQualifiedName` in interface `NSName`
  Returns:
    the qualified name

Skip navigation links

Oracle® Database XML Java API Reference 11g Release 2 (11.2) E10769-01

Copyright © 2003, 2009, Oracle and/or its affiliates. All rights reserved.