All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class oracle.xml.parser.v2.XMLDocument

java.lang.Object
   |
   +----oracle.xml.parser.v2.XMLNode
           |
           +----oracle.xml.parser.v2.XMLDocument

public class XMLDocument
extends XMLNode
implements Document, Serializable
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.


Constructor Index

 o XMLDocument()
Creates an empty document.

Method Index

 o cloneNode(boolean)
Returns a duplicate of this document node.
 o createAttribute(String)
Creates an Attr of the given name.
 o createCDATASection(String)
Creates a CDATASection node whose value is the specified string.
 o createComment(String)
Creates a Comment node given the specified string.
 o createDocumentFragment()
Creates an empty DocumentFragment object.
 o createElement(String)
Creates an element of the type specified.
 o createEntityReference(String)
Creates an EntityReference object.
 o createProcessingInstruction(String, String)
Creates a ProcessingInstruction node given the specified name and data strings.
 o createTextNode(String)
Creates a Text node given the specified string.
 o expectedElements(Element)
Returns vector of element names that can be appended to the element.
 o getDoctype()
The Document Type Declaration (DTD) associated with this document.
 o getDocumentElement()
This is a convenience attribute that allows direct access to the child node that is the root element of the document.
 o getElementsByTagName(String)
Returns a NodeList of all the Elements with a given tag name in the order in which they would be encountered in a preorder traversal of the Document tree.
 o getEncoding()
Retrieves the character encoding information.
 o getImplementation()
The DOMImplementation object that handles this document.
 o getOwnerDocument()
The Document object associated with this node.
 o getStandalone()
Retrieves the standalone information.
 o getVersion()
Retrieves the version information.
 o print(OutputStream)
Writes the contents of this document to the given output stream.
 o print(OutputStream, String)
Writes the contents of this document to the given output stream.
 o print(PrintWriter)
Writes the contents of this document to the given output stream.
 o printExternalDTD(OutputStream)
Writes the contents of this document to the given output stream.
 o printExternalDTD(OutputStream, String)
Writes the contents of the external DTD to the given output stream.
 o printExternalDTD(PrintWriter)
Writes the contents of this document to the given output stream.
 o replaceChild(Node, Node)
Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.
 o setDoctype(String, String, String)
Sets the doctype URI for the document
 o setEncoding(String)
Sets the character encoding for output.
 o setLocale(Locale)
Sets the locale for error reporting
 o setStandalone(String)
Sets the standalone information stored in the <?xml ...?> tag.
 o setVersion(String)
Sets the version number stored in the <?xml ...?> tag.
 o validateElementContent(Element)
Validates the content of a element node.

Constructors

 o XMLDocument
 public XMLDocument()
Creates an empty document.

Methods

 o 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.

Returns:
The associated DTD
See Also:
DocumentType
 o getImplementation
 public DOMImplementation getImplementation()
The DOMImplementation object that handles this document. A DOM application may use objects from multiple implementations.

Returns:
The associated DOM implementation.
 o 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.

Returns:
The root element
 o getOwnerDocument
 public Document getOwnerDocument()
The Document object associated with this node. Since this node is a Document this is null.

Returns:
null
Overrides:
getOwnerDocument in class XMLNode
 o createElement
 public Element createElement(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.

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.
 o createDocumentFragment
 public DocumentFragment createDocumentFragment()
Creates an empty DocumentFragment object.

Returns:
A new DocumentFragment.
 o createTextNode
 public Text createTextNode(String data)
Creates a Text node given the specified string.

Parameters:
data - The data for the node.
Returns:
The new Text object.
 o createComment
 public Comment createComment(String data)
Creates a Comment node given the specified string.

Parameters:
data - The data for the node.
Returns:
The new Comment object.
 o createCDATASection
 public CDATASection createCDATASection(String data) throws DOMException
Creates a CDATASection node whose value is the specified string.

Parameters:
data - The data for the CDATASection contents.
Returns:
The new CDATASection object.
Throws: DOMException
A DOMException could be thrown.
 o createProcessingInstruction
 public ProcessingInstruction createProcessingInstruction(String target,
                                                          String data) throws DOMException
Creates a ProcessingInstruction node given the specified name and data strings.

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.
 o createAttribute
 public Attr createAttribute(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.

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.
 o createEntityReference
 public EntityReference createEntityReference(String name) throws DOMException
Creates an EntityReference object.

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.
 o getElementsByTagName
 public NodeList getElementsByTagName(String tagname)
Returns a NodeList of all the Elements with a given tag name in the order in which they would be encountered in a preorder traversal of the Document tree.

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 Elements.
 o 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

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.
Overrides:
replaceChild in class XMLNode
 o cloneNode
 public Node cloneNode(boolean deep)
Returns a duplicate of this document node.

Parameters:
deep - If true, recursively clone the subtree under the document; if false, clone only the document itself
Returns:
The duplicate document node.
Overrides:
cloneNode in class XMLNode
 o setDoctype
 public void setDoctype(String rootname,
                        String sysid,
                        String pubid)
Sets the doctype URI for the document

Parameters:
root - The name of the root element
sysid - The system id of the doctype
pubid - The public id of the doctype
 o print
 public void print(PrintWriter out) throws IOException
Writes the contents of this document to the given output stream.

Parameters:
out - PrintWriter to write to
Throws: IOException
if an error occurs
Overrides:
print in class XMLNode
 o print
 public void print(OutputStream out) throws IOException
Writes the contents of this document to the given output stream.

Parameters:
out - OutputStream to write to
Throws: IOException
if an error occurs
Overrides:
print in class XMLNode
 o print
 public void print(OutputStream out,
                   String enc) throws IOException
Writes the contents of this document to the given output stream.

Parameters:
out - OutputStream to write to
enc - Encoding to use for the output
Throws: IOException
if an invalid encoding was specified or if any other error occurs
Overrides:
print in class XMLNode
 o printExternalDTD
 public void printExternalDTD(PrintWriter out) throws IOException
Writes the contents of this document to the given output stream.

Parameters:
out - PrintWriter to write to
Throws: IOException
if an error occurs
 o printExternalDTD
 public void printExternalDTD(OutputStream out) throws IOException
Writes the contents of this document to the given output stream.

Parameters:
out - OutputStream to write to
Throws: IOException
if an error occurs
 o printExternalDTD
 public void printExternalDTD(OutputStream out,
                              String enc) throws 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: IOException
if an invalid encoding was specified or if any other error occurs
 o 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
 o setLocale
 public final void setLocale(Locale locale)
Sets the locale for error reporting

Parameters:
locale - Locale for error reporting.
 o expectedElements
 public Vector expectedElements(Element e)
Returns vector of element names that can be appended to the element.

Parameters:
e - Element
Returns:
Vector of names
 o getVersion
 public final String getVersion()
Retrieves the version information.

Returns:
the version number stored in the <?xml ...?> tag.
 o setVersion
 public final void setVersion(String version)
Sets the version number stored in the <?xml ...?> tag.

Parameters:
version - The version information to set.
 o getEncoding
 public final 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.
 o setEncoding
 public final void setEncoding(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
 o getStandalone
 public final String getStandalone()
Retrieves the standalone information.

Returns:
the standalone attribute stored in the <?xml ...?> tag.
 o setStandalone
 public final void setStandalone(String value)
Sets the standalone information stored in the <?xml ...?> tag.

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

All Packages  Class Hierarchy  This Package  Previous  Next  Index