oracle.xml.parser.v2

## Class XMLDocument

- java.lang.Object
- - oracle.xml.parser.v2.XMLNode
  - - oracle.xml.parser.v2.XMLNSNode
    - - oracle.xml.parser.v2.XMLElement
      - - oracle.xml.parser.v2.XMLDocument

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

    public class XMLDocument
    extends XMLElement
    implements Document, java.io.Externalizable, DocumentTraversal, DocumentEvent, DocumentEditVAL, EventTarget

This class implements the DOM Document interface, represents an entire XML document and serves the root of the Document Object Model tree. Each XML tag can either represent a node or a leaf of this tree.

According to the XML specification, the root of the tree consists of any combination of comments and processing instructions, but only one root element. A helper method `getDocumentElement` is provided as a short cut to finding the root element.

See Also:
  Serialized Form

### Field Summary

Fields
`static java.lang.String` `ACCESS_MODE`
`static int` `COMPACT_OFF`
`static java.lang.String` `FORWARD_READ`
`static java.lang.String` `READ_ONLY`
`static java.lang.String` `SCALABLE_DOM`
`static java.lang.String` `STREAM_READ`
`static java.lang.String` `THICK`
`static java.lang.String` `THIN`
`static java.lang.String` `UPDATEABLE`

### Fields inherited from class oracle.xml.parser.v2.XMLElement

`ANY_CONTENTTYPE, ELEMENTS_CONTENTTYPE, EMPTY_CONTENTTYPE, 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, 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.NodeEditVAL

`VAL_FALSE, VAL_INCOMPLETE, VAL_NS_WF, VAL_SCHEMA, VAL_TRUE, VAL_UNKNOWN, VAL_WF`

### Fields inherited from interface org.w3c.dom.validation.ElementEditVAL

`VAL_ANY_CONTENTTYPE, VAL_ELEMENTS_CONTENTTYPE, VAL_EMPTY_CONTENTTYPE, VAL_MIXED_CONTENTTYPE, VAL_SIMPLE_CONTENTTYPE`

### Constructor Summary

Constructors
Constructor and Description
`XMLDocument()` Creates an empty document.

### Method Summary

All Methods Instance Methods Concrete Methods Deprecated Methods
`void` `addID(java.lang.String name, XMLElement e)` Add a ID Element associated with this document
`Node` `adoptNode(Node srcNodeArg)` Adopts a node from another document to this document.
`Node` `appendChild(Node elem)` Appends a new node to the document
`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` `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.
`Attr` `createAttribute(java.lang.String name)` Creates an `Attr` of the given name.
`Attr` `createAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName)` Creates an attribute with the given qualified name and namespace URI.
`CDATASection` `createCDATASection(java.lang.String data)` Creates a `CDATASection` node whose value is the specified string.
`Comment` `createComment(java.lang.String data)` Creates a `Comment` node given the specified string.
`DocumentFragment` `createDocumentFragment()` Creates an empty `DocumentFragment` object.
`Element` `createElement(java.lang.String tagName)` Creates an element of the type specified.
`Element` `createElementNS(java.lang.String namespaceURI, java.lang.String qualifiedName)` Creates an element of the given qualified name and namespace URI.
`EntityReference` `createEntityReference(java.lang.String name)` Creates an EntityReference object.
`Event` `createEvent(java.lang.String type)` Creates an event object of the specified type
`MutationEvent` `createMutationEvent(java.lang.String type)` Creates a Mutation Event object of specified type
`NodeIterator` `createNodeIterator(Node root, int whatToShow, NodeFilter filter, boolean expandEntityReferences)` Creates a Node Iterator with specified root, flag which governs what type of nodes it should include in logical view, filter for filtering nodes, flag determining whether entity references and its descendants could be included
`ProcessingInstruction` `createProcessingInstruction(java.lang.String target, java.lang.String data)` Creates a `ProcessingInstruction` node given the specified name and data strings.
`Range` `createRange()` Create a new Document Range Object, with Start and End Boundary points at the begining of the document.
`Event` `createRangeEvent(java.lang.String type)` Creates a Range Event object of specified type
`Text` `createTextNode(java.lang.String data)` Creates a `Text` node given the specified string.
`Event` `createTraversalEvent(java.lang.String type)` Creates a Traversal Event object of specified type
`TreeWalker` `createTreeWalker(Node root, int whatToShow, NodeFilter filter, boolean expandEntityReferences)` Creates a Node Iterator with specified root, flag which governs what type of nodes it should include in logical view, filter for filtering nodes, flag determining whether entity references and its descendants could be included
`java.util.Vector` `expectedElements(Element e)` Returns vector of element names that can be appended to the element.
`NamedNodeMap` `getAttributes()` A `NamedNodeMap` containing the attributes of this node (if it is an `Element`) or `null` otherwise.
`int` `getColumnNumber()` Get column number debug information
`boolean` `getContinuousValidityChecking()` An attribute specifying whether the validity of the document is continuously enforced.
`boolean` `getDebugMode()` Get the debug flag
`NameList` `getDefinedElements(java.lang.String namespaceURI)` Returns list of all element information item names of global declaration, belonging to the specified namespace.
`DocumentType` `getDoctype()` The Document Type Declaration (DTD) associated with this document.
`Element` `getDocumentElement()` This is a convenience attribute that allows direct access to the child node that is the root element of the document.
`Element` `getElementById(java.lang.String elementId)` Returns the Element whose ID is given by elementId.
`NodeList` `getElementsByTagName(java.lang.String tagname)` Returns a `NodeList` of all the `Element`s with a given tag name in the order in which they would be encountered in a preorder traversal of the `Document` tree.
`NodeList` `getElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String localName)` Returns a NodeList of all the Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of the Document tree.
`java.lang.String` `getEncoding()` Retrieves the character encoding information.
`XMLElement` `getIDElement(java.lang.String idValue)` Deprecated. As of DOM 2
`java.util.Hashtable` `getIDHashtable()` Get the ID element hashtable in the XML DOM Tree
`DOMImplementation` `getImplementation()` The `DOMImplementation` object that handles this document.
`int` `getLineNumber()` Get line number debug information
`java.lang.String` `getLocalName()` Gets the local Name for this element.
`java.lang.String` `getNamespaceURI()` Gets the namespace URI of this node.
`Node` `getNextSibling()` Gets The node immediately following this node.
`java.lang.String` `getNodeName()` Gets a name of the node
`short` `getNodeType()` Gets a code representing the type of the underlying object
`Document` `getOwnerDocument()` The `Document` object associated with this node.
`Node` `getParentNode()` Gets the parent of this node.
`Node` `getPreviousSibling()` Gets the node immediately preceding this node.
`XMLSchema` `getSchema()` return the validator
`java.lang.String` `getStandalone()` Retrieves the standalone information.
`java.lang.String` `getSystemId()` Get the system id of the entity contain this node
`java.lang.String` `getText()` Returns the non-marked-up text contained by this element.
`java.lang.String` `getVersion()` Retrieves the version information.
`XMLNode` `getXMLNodeFromNode(Node node)`
`XMLNode` `importBinary(BinaryNav nav)` Import binary from a binaryNav Create corresponding Element node
`Node` `importNode(Node importedNode, boolean deep)` Imports a node from another document to this document.
`Node` `importNode(Node context, java.lang.String pattern)` Import node selected by given xpath from the context On Scalable DOM, if the xpath is streamable, the evaluation will switch to streaming xpath, avoid massive node materialization
`Node` `insertBefore(Node newChild, Node refChild)` Inserts the node `newChild` before the existing child node `refChild`.
`short` `nodeValidity(short wFValidityCheckLevel)` Determines if the node is valid relative to the validation type specified in `valType`.
`void` `print(java.io.OutputStream out)` Writes the contents of this document to the given output stream.
`void` `print(java.io.OutputStream out, java.lang.String enc)` Writes the contents of this document to the given output stream.
`void` `print(PrintDriver pd)` Writes the contents of this document to the given output stream.
`void` `print(java.io.PrintWriter out)` Writes the contents of this document to the given output stream.
`void` `print(java.io.Writer out)` Writes the contents of this document to the given output stream.
`void` `printExternalDTD(java.io.OutputStream out)` Writes the contents of this document to the given output stream.
`void` `printExternalDTD(java.io.OutputStream out, java.lang.String enc)` Writes the contents of the external DTD to the given output stream.
`void` `printExternalDTD(java.io.PrintWriter out)` Writes the contents of this document to the given output stream.
`Node` `removeChild(Node elem)` removes the elem from this documents list of child nodes
`Node` `replaceChild(Node newChild, Node oldChild)` Replaces the child node `oldChild` with `newChild` in the list of children, and returns the `oldChild` node.
`void` `reportSAXEvents(ContentHandler cntHandler)` Report SAX Events from a DOM Tree
`void` `save(InfosetWriter writer)`
`void` `save(InfosetWriter writer, boolean ref)` Serialize DOM using InfosetWriter
`void` `setContinuousValidityChecking(boolean continuousValidityChecking)` An attribute specifying whether the validity of the document is continuously enforced.
`void` `setDoctype(java.lang.String rootname, java.lang.String sysid, java.lang.String pubid)` Sets the doctype URI for the document
`void` `setEncoding(java.lang.String encoding)` Sets the character encoding for output.
`void` `setLocale(java.util.Locale locale)` Sets the locale for error reporting
`void` `setParsedDoctype(java.lang.String rootname, java.lang.String sysid, java.lang.String pubid)` Sets the doctype object by parsing sysid
`void` `setSchema(XMLSchema schema)` set the XML Schema
`void` `setStandalone(java.lang.String value)` Sets the standalone information stored in the <?
`void` `setVersion(java.lang.String version)` Sets the version number stored in the <?
`short` `validateDocument()` Validates the document against the schema, e.g., a DTD or an XML Schema or another.
`boolean` `validateElementContent(Element e)` Validates the content of a element node.

### Methods inherited from class oracle.xml.parser.v2.XMLElement

`canRemoveAttribute, canRemoveAttributeNode, canRemoveAttributeNS, canSetAttribute, canSetAttributeNode, canSetAttributeNS, canSetTextContent, getAllowedAttributes, getAllowedChildren, getAllowedFirstChildren, getAllowedNextSiblings, getAllowedParents, getAllowedPreviousSiblings, getAttribute, getAttributeNode, getAttributeNode, getAttributeNodeNS, getAttributeNS, getChildrenByTagName, getChildrenByTagName, getContentType, getDefaultValue, getEnumeratedValues, getExpandedName, getFirstAttribute, getNextSiblingByName, getPrefix, getQualifiedName, getRequiredAttributes, getTagName, hasAttribute, hasAttributeNS, hasAttributes, isElementDefined, isElementDefinedNS, normalize, removeAttribute, removeAttributeNode, removeAttributeNS, resolveNamespacePrefix, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setPrefix, validateContent, validateContent, validateContent, validateContent`

### Methods inherited from class oracle.xml.parser.v2.XMLNSNode

`addText, addText, getChildNodes, getFirstChild, getLastChild`

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

`addEventListener, cloneNode, dispatchEvent, equals, getFirstChildAsOffset, getNextSiblingAsOffset, getNodeValue, getNodeValueAsBinaryStream, getNodeValueAsBinaryStream, getNodeValueAsCharacterStream, getNodeValueAsCharacterStream, getPrimitiveTypeId, getProperty, getXMLError, hasChildNodes, hashCode, isDocumentFlag, isNodeFlag, isSupported, 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

`getClass, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.w3c.dom.Node

`cloneNode, getChildNodes, getFirstChild, getLastChild, getNodeValue, getPrefix, hasAttributes, hasChildNodes, isSupported, normalize, setNodeValue, setPrefix`

### Methods inherited from interface java.io.Externalizable

`readExternal, writeExternal`

### Methods inherited from interface org.w3c.dom.validation.DocumentEditVAL

`setContinuousValidityChecking`

### Methods inherited from interface org.w3c.dom.validation.NodeEditVAL

`getDefaultValue, getEnumeratedValues`

### Methods inherited from interface org.w3c.dom.events.EventTarget

`addEventListener, dispatchEvent, removeEventListener`

### Methods inherited from interface oracle.xml.util.NSName

`getNamespace`

### Methods inherited from interface org.w3c.dom.validation.ElementEditVAL

`getAllowedFirstChildElements`

### Field Detail

#### COMPACT_OFF

    public static final int COMPACT_OFF

See Also:
  Constant Field Values

#### THICK

    public static final java.lang.String THICK

See Also:
  Constant Field Values

#### THIN

    public static final java.lang.String THIN

See Also:
  Constant Field Values

#### ACCESS_MODE

    public static final java.lang.String ACCESS_MODE

See Also:
  Constant Field Values

#### UPDATEABLE

    public static final java.lang.String UPDATEABLE

See Also:
  Constant Field Values

#### READ_ONLY

    public static final java.lang.String READ_ONLY

See Also:
  Constant Field Values

#### FORWARD_READ

    public static final java.lang.String FORWARD_READ

See Also:
  Constant Field Values

#### STREAM_READ

    public static final java.lang.String STREAM_READ

See Also:
  Constant Field Values

#### SCALABLE_DOM

    public static final java.lang.String SCALABLE_DOM

See Also:
  Constant Field Values

### Constructor Detail

#### XMLDocument

    public XMLDocument()

Creates an empty document.

### Method Detail

#### save

    public void save(InfosetWriter writer)
              throws java.io.IOException

Throws:
  `java.io.IOException`

#### save

    public void save(InfosetWriter writer,
                     boolean ref)
              throws java.io.IOException

Serialize DOM using InfosetWriter

Parameters:
  `writer` - The InfosetWriter to use
  `ref` - indicate fully serialization or allow references
Throws:
  `java.io.IOException`

#### getDoctype

    public DocumentType getDoctype()

The Document Type Declaration (DTD) associated with this document. For XML documents without a DTD, this returns `null`. Note that the DOM Level 1 specification does not support editing the DTD.

Specified by:
  `getDoctype` in interface `Document`
Returns:
  The associated DTD
See Also:
  `DocumentType`

#### getNodeType

    public short getNodeType()

Gets a code representing the type of the underlying object

Specified by:
  `getNodeType` in interface `Node`
Overrides:
  `getNodeType` in class `XMLElement`
Returns:
  type of the node

#### getNodeName

    public java.lang.String getNodeName()

Gets a name of the node

Specified by:
  `getNodeName` in interface `Node`
Overrides:
  `getNodeName` in class `XMLElement`
Returns:
  name of the node

#### getParentNode

    public Node getParentNode()

Gets the parent of this node. All nodes, except `Document`, `DocumentFragment`, and `Attr` may have a parent. However, if a node has just been created and not yet added to the tree, or if it has been removed from the tree, this is `null`.

Specified by:
  `getParentNode` in interface `Node`
Overrides:
  `getParentNode` in class `XMLNode`
Returns:
  The parent of this node

#### getImplementation

    public DOMImplementation getImplementation()

The `DOMImplementation` object that handles this document. A DOM application may use objects from multiple implementations.

Specified by:
  `getImplementation` in interface `Document`
Returns:
  The associated DOM implementation.

#### getNamespaceURI

    public java.lang.String getNamespaceURI()

Description copied from class: `XMLElement`
Gets the namespace URI of this node.

Specified by:
  `getNamespaceURI` in interface `Node`
Overrides:
  `getNamespaceURI` in class `XMLElement`
Returns:
  the namespace URI of this element
Since:
  DOM 2 Gets the name space URI of this element

#### getLocalName

    public java.lang.String getLocalName()

Gets the local Name for this element.

Specified by:
  `getLocalName` in interface `NSName`
Specified by:
  `getLocalName` in interface `Node`
Overrides:
  `getLocalName` in class `XMLElement`
Returns:
  the local Name

#### getPreviousSibling

    public Node getPreviousSibling()

Gets the node immediately preceding this node. If there is no such node, this returns `null`.

Specified by:
  `getPreviousSibling` in interface `Node`
Overrides:
  `getPreviousSibling` in class `XMLNode`
Returns:
  the previous node

#### getNextSibling

    public Node getNextSibling()

Gets The node immediately following this node. If there is no such node, this returns `null`.

Specified by:
  `getNextSibling` in interface `Node`
Overrides:
  `getNextSibling` in class `XMLNode`
Returns:
  the next node

#### getAttributes

    public NamedNodeMap getAttributes()

Description copied from class: `XMLElement`
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 `XMLElement`
Returns:
  always null

#### getDocumentElement

    public Element getDocumentElement()

This is a convenience attribute that allows direct access to the child node that is the root element of the document.

Specified by:
  `getDocumentElement` in interface `Document`
Returns:
  The root element

#### getOwnerDocument

    public Document getOwnerDocument()

The `Document` object associated with this node. Since this node is a `Document` this is `null`.

Specified by:
  `getOwnerDocument` in interface `Node`
Overrides:
  `getOwnerDocument` in class `XMLNode`
Returns:
  `null`

#### createElement

    public Element createElement(java.lang.String tagName)
                          throws DOMException

Creates an element of the type specified. Note that the instance returned implements the Element interface, so attributes can be specified directly on the returned object.

Specified by:
  `createElement` in interface `Document`
Parameters:
  `tagName` - The name of the element type to instantiate. The name is treated as case-sensitive.
Returns:
  A new `Element` object.
Throws:
  `DOMException` - INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.

#### createDocumentFragment

    public DocumentFragment createDocumentFragment()

Creates an empty `DocumentFragment` object.

Specified by:
  `createDocumentFragment` in interface `Document`
Returns:
  A new `DocumentFragment`.

#### createTextNode

    public Text createTextNode(java.lang.String data)

Creates a `Text` node given the specified string.

Specified by:
  `createTextNode` in interface `Document`
Parameters:
  `data` - The data for the node.
Returns:
  The new `Text` object.

#### createComment

    public Comment createComment(java.lang.String data)

Creates a `Comment` node given the specified string.

Specified by:
  `createComment` in interface `Document`
Parameters:
  `data` - The data for the node.
Returns:
  The new `Comment` object.

#### createCDATASection

    public CDATASection createCDATASection(java.lang.String data)
                                    throws DOMException

Creates a `CDATASection` node whose value is the specified string.

Specified by:
  `createCDATASection` in interface `Document`
Parameters:
  `data` - The data for the `CDATASection` contents.
Returns:
  The new `CDATASection` object.
Throws:
  `DOMException` - A `DOMException` could be thrown.

#### createProcessingInstruction

    public ProcessingInstruction createProcessingInstruction(java.lang.String target,
                                                             java.lang.String data)
                                                      throws DOMException

Creates a `ProcessingInstruction` node given the specified name and data strings.

Specified by:
  `createProcessingInstruction` in interface `Document`
Parameters:
  `target` - The target part of the processing instruction.
  `data` - The data for the node.
Returns:
  The new `ProcessingInstruction` object.
Throws:
  `DOMException` - INVALID_CHARACTER_ERR: Raised if an invalid character is specified.

#### createAttribute

    public Attr createAttribute(java.lang.String name)
                         throws DOMException

Creates an `Attr` of the given name. Note that the `Attr` instance can then be set on an `Element` using the `setAttribute` method.

Specified by:
  `createAttribute` in interface `Document`
Parameters:
  `name` - The name of the attribute.
Returns:
  A new `Attr` object.
Throws:
  `DOMException` - INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.

#### createEntityReference

    public EntityReference createEntityReference(java.lang.String name)
                                          throws DOMException

Creates an EntityReference object.

Specified by:
  `createEntityReference` in interface `Document`
Parameters:
  `name` - The name of the entity to reference.
Returns:
  The new `EntityReference` object.
Throws:
  `DOMException` - INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.

#### getElementsByTagName

    public NodeList getElementsByTagName(java.lang.String tagname)

Returns a `NodeList` of all the `Element`s with a given tag name in the order in which they would be encountered in a preorder traversal of the `Document` tree.

Specified by:
  `getElementsByTagName` in interface `Document`
Specified by:
  `getElementsByTagName` in interface `Element`
Overrides:
  `getElementsByTagName` in class `XMLElement`
Parameters:
  `tagname` - The name of the tag to match on. The special value "*" matches all tags.
Returns:
  A new `NodeList` object containing all the matched `Element`s.

#### appendChild

    public Node appendChild(Node elem)
                     throws DOMException

Appends a new node to the document

Specified by:
  `appendChild` in interface `Node`
Overrides:
  `appendChild` in class `XMLNSNode`
Parameters:
  `elem` - the new node to be added
Returns:
  the node after appending it to the document
Throws:
  `DOMException` - HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the `elem` node.
  WRONG_DOCUMENT_ERR: Raised if `elem` was created from a different document than this one.

#### replaceChild

    public Node replaceChild(Node newChild,
                             Node oldChild)
                      throws DOMException

Replaces the child node `oldChild` with `newChild` in the list of children, and returns the `oldChild` node. If the `newChild` is already in the tree, it is first removed. This is an override of the `XMLNode.removeChild` method

Specified by:
  `replaceChild` in interface `Node`
Overrides:
  `replaceChild` in class `XMLNSNode`
Parameters:
  `newChild` - The new node to put in the child list.
  `oldChild` - The node being replaced in the list.
Returns:
  The node replaced.
Throws:
  `DOMException` - HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the `newChild` node.
  WRONG_DOCUMENT_ERR: Raised if `newChild` was created from a different document than this one.
  NOT_FOUND_ERR: Raised if `oldChild` is not a child of this node.

#### removeChild

    public Node removeChild(Node elem)
                     throws DOMException

removes the elem from this documents list of child nodes

Specified by:
  `removeChild` in interface `Node`
Overrides:
  `removeChild` in class `XMLNSNode`
Parameters:
  `elem` - the node to be removed
Returns:
  the node after it's removed from the document
Throws:
  `DOMException` - NO_MODIFICATION_ALLOWED_ERR: Raised if this document is readonly.
  NOT_FOUND_ERR: Raised if `oldChild` is not a child of this node.

#### insertBefore

    public Node insertBefore(Node newChild,
                             Node refChild)
                      throws DOMException

Inserts the node `newChild` before the existing child node `refChild`. If `refChild` is `null`, insert `newChild` at the end of the list of children.
If `newChild` is a `DocumentFragment` object, all of its children are inserted, in the same order, before `refChild`. If the `newChild` is already in the tree, it is first removed.

Specified by:
  `insertBefore` in interface `Node`
Overrides:
  `insertBefore` in class `XMLNSNode`
Parameters:
  `newChild` - The node to insert.
  `refChild` - The reference node, i.e., the node before which the new node must be inserted.
Returns:
  The node being inserted.
Throws:
  `DOMException` - HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the `newChild` node, or if the node to insert is one of this node's ancestors.
  WRONG_DOCUMENT_ERR: Raised if `newChild` was created from a different document than the one that created this node.
  NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
  NOT_FOUND_ERR: Raised if `refChild` is not a child of this node.

#### setParsedDoctype

    public void setParsedDoctype(java.lang.String rootname,
                                 java.lang.String sysid,
                                 java.lang.String pubid)
                          throws DOMException

Sets the doctype object by parsing sysid

Parameters:
  `rootname` - The name of the root element
  `sysid` - The system id of the doctype
  `pubid` - The public id of the doctype (can be null)
Throws:
  `DOMException`

#### setDoctype

    public void setDoctype(java.lang.String rootname,
                           java.lang.String sysid,
                           java.lang.String pubid)

Sets the doctype URI for the document

Parameters:
  `rootname` - The name of the root element
  `sysid` - The system id of the doctype
  `pubid` - The public id of the doctype (can be null)

#### addID

    public void addID(java.lang.String name,
                      XMLElement e)

Add a ID Element associated with this document

Parameters:
  `name` - String - id value
  `e` - XMLElement associated with id

#### getIDElement

    public XMLElement getIDElement(java.lang.String idValue)

Deprecated. As of DOM 2

Parameters:
  `idValue` -
Returns:
  XMLElement associated with idvalue
See Also:
  `Get the element in the XML DOM Tree with a given ID`

#### getIDHashtable

    public java.util.Hashtable getIDHashtable()

Get the ID element hashtable in the XML DOM Tree

Returns:
  Hashtable - associated with XMLDocument

#### getText

    public java.lang.String getText()

Returns the non-marked-up text contained by this element. For text elements, this is the raw data. For elements with child nodes, this method traverses the entire subtree and appends the text for each terminal text element, effectively stripping out the XML markup for the subtree. For example, if the XML document contains the following: <xmp> <AUTHOR> <FIRST>William</FIRST> <LAST>Shakespeare</LAST> </AUTHOR> </xmp>

`XMLDocument.getText` returns "William Shakespeare".

Overrides:
  `getText` in class `XMLNSNode`
Returns:
  non-marked-up text contained bu this element

#### print

    public void print(java.io.PrintWriter out)
               throws java.io.IOException

Writes the contents of this document to the given output stream.

Overrides:
  `print` in class `XMLNode`
Parameters:
  `out` - `PrintWriter` to write to
Throws:
  `java.io.IOException` - if an error occurs

#### print

    public void print(java.io.Writer out)
               throws java.io.IOException

Writes the contents of this document to the given output stream.

Overrides:
  `print` in class `XMLNode`
Parameters:
  `out` - `Writer` to write to
Throws:
  `java.io.IOException` - if an error occurs

#### print

    public void print(java.io.OutputStream out)
               throws java.io.IOException

Writes the contents of this document to the given output stream.

Overrides:
  `print` in class `XMLNode`
Parameters:
  `out` - `OutputStream` to write to
Throws:
  `java.io.IOException` - if an error occurs

#### print

    public void print(java.io.OutputStream out,
                      java.lang.String enc)
               throws java.io.IOException

Writes the contents of this document to the given output stream.

Overrides:
  `print` in class `XMLNode`
Parameters:
  `out` - `OutputStream` to write to
  `enc` - Encoding to use for the output
Throws:
  `java.io.IOException` - if an invalid encoding was specified or if any other error occurs

#### print

    public void print(PrintDriver pd)
               throws java.io.IOException

Writes the contents of this document to the given output stream.

Parameters:
  `pd` - `PrintDriver` used to write each node
Throws:
  `java.io.IOException` - if an error occurs

#### printExternalDTD

    public void printExternalDTD(java.io.PrintWriter out)
                          throws java.io.IOException

Writes the contents of this document to the given output stream.

Parameters:
  `out` - `PrintWriter` to write to
Throws:
  `java.io.IOException` - if an error occurs

#### printExternalDTD

    public void printExternalDTD(java.io.OutputStream out)
                          throws java.io.IOException

Writes the contents of this document to the given output stream.

Parameters:
  `out` - `OutputStream` to write to
Throws:
  `java.io.IOException` - if an error occurs

#### printExternalDTD

    public void printExternalDTD(java.io.OutputStream out,
                                 java.lang.String enc)
                          throws java.io.IOException

Writes the contents of the external DTD to the given output stream.

Parameters:
  `out` - `OutputStream` to write to
  `enc` - Encoding to use for the output
Throws:
  `java.io.IOException` - if an invalid encoding was specified or if any other error occurs

#### reportSAXEvents

    public void reportSAXEvents(ContentHandler cntHandler)
                         throws SAXException

Report SAX Events from a DOM Tree

Overrides:
  `reportSAXEvents` in class `XMLElement`
Parameters:
  `cntHandler` - ContentHandler
Throws:
  `SAXException` - thrown by SAX Callback functions

#### validateElementContent

    public boolean validateElementContent(Element e)

Validates the content of a element node.

Parameters:
  `e` - Element to be validated
Returns:
  True if valid, else false

#### setLocale

    public final void setLocale(java.util.Locale locale)

Sets the locale for error reporting

Parameters:
  `locale` - Locale for error reporting.

#### expectedElements

    public java.util.Vector expectedElements(Element e)

Returns vector of element names that can be appended to the element.

Parameters:
  `e` - Element
Returns:
  Vector of names

#### getVersion

    public java.lang.String getVersion()

Retrieves the version information.

Returns:
  the version number stored in the <?xml ...?> tag.

#### setVersion

    public void setVersion(java.lang.String version)

Sets the version number stored in the <?xml ...?> tag.

Parameters:
  `version` - The version information to set.

#### getEncoding

    public java.lang.String getEncoding()

Retrieves the character encoding information.

Returns:
  the encoding information stored in the <?xml ...?> tag or the user-defined output encoding if it has been more recently set or user-provided output encoding through command line option, -Doracle.xml.parser.default.character.set.

#### setEncoding

    public void setEncoding(java.lang.String encoding)

Sets the character encoding for output. Eventually it sets the ENCODING stored in the <?xml ...?> tag, but not until the document is saved. You should not call this method until the Document has been loaded.

Parameters:
  `encoding` - The character encoding to set

#### getStandalone

    public final java.lang.String getStandalone()

Retrieves the standalone information.

Returns:
  the standalone attribute stored in the <?xml ...?> tag.

#### setStandalone

    public void setStandalone(java.lang.String value)

Sets the standalone information stored in the <?xml ...?> tag.

Parameters:
  `value` - The attribute value ('yes' or 'no').

#### getDebugMode

    public boolean getDebugMode()

Get the debug flag

Overrides:
  `getDebugMode` in class `XMLNode`
Returns:
  boolean flag

#### getLineNumber

    public int getLineNumber()

Get line number debug information

Overrides:
  `getLineNumber` in class `XMLNode`
Returns:
  line the line number

#### getColumnNumber

    public int getColumnNumber()

Get column number debug information

Overrides:
  `getColumnNumber` in class `XMLNode`
Returns:
  column the column number

#### getSystemId

    public java.lang.String getSystemId()

Get the system id of the entity contain this node

Overrides:
  `getSystemId` in class `XMLNode`
Returns:
  sysid the system id

#### adoptNode

    public Node adoptNode(Node srcNodeArg)
                   throws DOMException

Adopts a node from another document to this document. The returned node has no parent; (parentNode is null). The source node is removed from the original document;

Parameters:
  `srcNodeArg` - Node to be adopted
Returns:
  Node with document association updated
Throws:
  `DOMException` - NOT_SUPPORTED_ERR: Raised if the type of the node being adopted is not supported.

#### importNode

    public Node importNode(Node importedNode,
                           boolean deep)
                    throws DOMException

Imports a node from another document to this document. The returned node has no parent; (parentNode is null). The source node is not altered or removed from the original document; this method creates a new copy of the source node.For all nodes, importing a node creates a node object owned by the importing document, with attribute values identical to the source node's nodeName and nodeType, plus the attributes related to namespaces (prefix, localName, and namespaceURI). As in the cloneNode operation on a Node, the source node is not altered.

Specified by:
  `importNode` in interface `Document`
Parameters:
  `importedNode` - Node to be imported
  `deep` - boolean variable indicating whether the descendants of this node are to be imported
Returns:
  A copy of the importedNode which is attached to the current document but not a part of the document tree
Throws:
  `DOMException` - NOT_SUPPORTED_ERR: Raised if the type of the node being imported is not supported.
Since:
  DOM 2

#### importBinary

    public XMLNode importBinary(BinaryNav nav)

Import binary from a binaryNav Create corresponding Element node

Parameters:
  `nav` - - the navigator of the binary
Returns:
  XMLNode - the XMLElement representing the element information

#### importNode

    public Node importNode(Node context,
                           java.lang.String pattern)
                    throws DOMException,
                           XSLException

Import node selected by given xpath from the context On Scalable DOM, if the xpath is streamable, the evaluation will switch to streaming xpath, avoid massive node materialization

Parameters:
  `context` - the context node for xpath
  `pattern` - the xpath to select the imported node
Returns:
  A copy of imported node
Throws:
  `DOMException`
  `XSLException`

#### createElementNS

    public Element createElementNS(java.lang.String namespaceURI,
                                   java.lang.String qualifiedName)
                            throws DOMException

Creates an element of the given qualified name and namespace URI.

Specified by:
  `createElementNS` in interface `Document`
Parameters:
  `namespaceURI` - - the namespace uri
  `qualifiedName` - - String qualified name for the element to be created
Returns:
  Element node with given qualified name and namespace URI
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 has a prefix that is "xml" and namespace URI is different from "http://www.w3.org/XML/1998/namespace"
Since:
  DOM 2

#### createAttributeNS

    public Attr createAttributeNS(java.lang.String namespaceURI,
                                  java.lang.String qualifiedName)
                           throws DOMException

Creates an attribute with the given qualified name and namespace URI.

Specified by:
  `createAttributeNS` in interface `Document`
Parameters:
  `namespaceURI` - - The namespace uri as String
  `qualifiedName` - - Qualified name for the attribute to be created as String
Returns:
  Element node with given qualified name and namespace URI
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 has a prefix that is "xml" and namespace URI is different from "http://www.w3.org/2000/xmlns/"
Since:
  DOM 2

#### getElementsByTagNameNS

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

Returns a NodeList of all the Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of the Document tree.

Specified by:
  `getElementsByTagNameNS` in interface `Document`
Specified by:
  `getElementsByTagNameNS` in interface `Element`
Overrides:
  `getElementsByTagNameNS` in class `XMLElement`
Parameters:
  `namespaceURI` - - The namespace uri that should match for the returned elements as String
  `localName` - - The local name that should match for the returned elements as String
Returns:
  nodelist of matching elements

#### getElementById

    public Element getElementById(java.lang.String elementId)

Returns the Element whose ID is given by elementId. If no such element exists, returns null. Behavior is not defined if more than one element has this ID.

Specified by:
  `getElementById` in interface `Document`
Parameters:
  `elementId` - String used to get the matching Id Element
Returns:
  The matching Id Element if one exists or null if none exists
Since:
  DOM 2

#### createNodeIterator

    public NodeIterator createNodeIterator(Node root,
                                           int whatToShow,
                                           NodeFilter filter,
                                           boolean expandEntityReferences)
                                    throws DOMException

Creates a Node Iterator with specified root, flag which governs what type of nodes it should include in logical view, filter for filtering nodes, flag determining whether entity references and its descendants could be included

Specified by:
  `createNodeIterator` in interface `DocumentTraversal`
Parameters:
  `root` - root node of the iterator
  `whatToShow` - flag indicating what type of nodes will be included
  `filter` - NodeFilter to filter unwanted nodes from iterator
  `expandEntityReferences` - flag to indicate traversal of entity references
Returns:
  object that implements NodeIterator interface, created on this document
Throws:
  `DOMException` - NOT_SUPPORTED_ERR: if the NodeIterator could not be created with specified root

#### createTreeWalker

    public TreeWalker createTreeWalker(Node root,
                                       int whatToShow,
                                       NodeFilter filter,
                                       boolean expandEntityReferences)
                                throws DOMException

Creates a Node Iterator with specified root, flag which governs what type of nodes it should include in logical view, filter for filtering nodes, flag determining whether entity references and its descendants could be included

Specified by:
  `createTreeWalker` in interface `DocumentTraversal`
Parameters:
  `root` - root node of the treewalker
  `whatToShow` - flag indicating what type of nodes will be included
  `filter` - NodeFilter to filter unwanted nodes from treewalker
  `expandEntityReferences` - flag to indicate traversal of entity references
Returns:
  an object that implements TreeWalker interface, created on this document
Throws:
  `DOMException` - NOT_SUPPORTED_ERR: if the TreeWalker could not be created with specified root

#### createRange

    public Range createRange()

Create a new Document Range Object, with Start and End Boundary points at the begining of the document.

Returns:
  new Range object with start and end boundary points at the begining of the document

#### createEvent

    public Event createEvent(java.lang.String type)

Creates an event object of the specified type

Specified by:
  `createEvent` in interface `DocumentEvent`
Parameters:
  `type` - the type of the event
Returns:
  Event object of the specified type

#### createMutationEvent

    public MutationEvent createMutationEvent(java.lang.String type)

Creates a Mutation Event object of specified type

Parameters:
  `type` - the type of the mutation event
Returns:
  Event object of the specified type

#### createRangeEvent

    public Event createRangeEvent(java.lang.String type)

Creates a Range Event object of specified type

Parameters:
  `type` - the type of the event
Returns:
  Event object of the specified type

#### createTraversalEvent

    public Event createTraversalEvent(java.lang.String type)

Creates a Traversal Event object of specified type

Parameters:
  `type` - the type of the event
Returns:
  Event object of the specified type

#### setSchema

    public void setSchema(XMLSchema schema)

set the XML Schema

Parameters:
  `schema` - to be set

#### getSchema

    public XMLSchema getSchema()

return the validator

Returns:
  `XMLSchema`

#### getContinuousValidityChecking

    public boolean getContinuousValidityChecking()

An attribute specifying whether the validity of the document is continuously enforced. When the attribute is set to `true`, the implementation may raise certain exceptions, depending on the situation (see the following). This attribute is `false` by default.

Specified by:
  `getContinuousValidityChecking` in interface `DocumentEditVAL`

#### setContinuousValidityChecking

    public void setContinuousValidityChecking(boolean continuousValidityChecking)
                                       throws DOMException,
                                              ExceptionVAL

An attribute specifying whether the validity of the document is continuously enforced. When the attribute is set to `true` , the implementation may raise certain exceptions, depending on the situation (see the following). This attribute is `false` by default.

Throws:
  `DOMException` - NOT_SUPPORTED_ERR: Raised if the implementation does not support setting this attribute to `true`.
  `ExceptionVAL` - NO_SCHEMA_AVAILABLE_ERR: Raised if this attribute is set to `true` and a schema is unavailable.
  `DOMException` - VALIDATION_ERR: Raised if an operation makes this document not compliant with the `VAL_INCOMPLETE` validity type or the document is invalid, and this attribute is set to `true` .

#### getDefinedElements

    public NameList getDefinedElements(java.lang.String namespaceURI)

Returns list of all element information item names of global declaration, belonging to the specified namespace.

Specified by:
  `getDefinedElements` in interface `DocumentEditVAL`
Parameters:
  `namespaceURI` - `namespaceURI` of namespace. For DTDs, this is `null`.
Returns:
  List of all element information item names belonging to the specified namespace or `null` if no schema is available.

#### validateDocument

    public short validateDocument()

Validates the document against the schema, e.g., a DTD or an XML Schema or another. This method's behavior is implementation- dependent; and the any attempt to modify any part of the document while validating results in implementation-dependent behavior. In addition, the validation operation itself cannot modify the document, e.g., for default attributes. This method makes use of the passed-in error handler, as described in the [ DOM Level 3 Core] `DOMConfiguration` interface, with all errors being `SEVERITY_ERROR` as defined in the `DOMError` interface.

Specified by:
  `validateDocument` in interface `DocumentEditVAL`
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 `XMLElement`
Parameters:
  `wFValidityCheckLevel` - Flag to tell at what level validity and well-formedness checking is done.
Returns:
  A validation state constant.

#### 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 `XMLElement`
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 `XMLElement`
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 `XMLElement`
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 `XMLElement`
Parameters:
  `newChild` - `Node` to be appended.
Returns:
  A validation state constant.

#### getXMLNodeFromNode

    public XMLNode getXMLNodeFromNode(Node node)

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