Skip navigation links

Oracle® Database XML Java API Reference
12c Release 1 (12.1)

E15981-09


oracle.xml.parser.v2
Class DTD

java.lang.Object
  extended by oracle.xml.parser.v2.XMLNode
      extended by oracle.xml.parser.v2.DTD

All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, java.lang.Cloneable, DocumentType, EventTarget, Node, NodeEditVAL

public class DTD
extends XMLNode
implements DocumentType, java.io.Externalizable

Implements the DOM DocumentType interface and holds the Document Type Definition information for an XML document.

See Also:
Serialized Form

Field Summary

 

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.NodeEditVAL
VAL_FALSE, VAL_INCOMPLETE, VAL_NS_WF, VAL_SCHEMA, VAL_TRUE, VAL_UNKNOWN, VAL_WF

 

Constructor Summary
DTD()
          Default constructor.

 

Method Summary
 XMLDocument convertDTD2Schema()
          get XML Schema DOM tree from this DTD object
 ElementDecl findElementDecl(java.lang.String name)
          Finds an element declaration for the given tag name.
 Entity findEntity(java.lang.String name, boolean isPE)
          Finds a named entity in the DTD.
 Notation findNotation(java.lang.String name)
          Retrieves the named notation from the DTD.
 NamedNodeMap getElementDecls()
          A NamedNodeMap containing the element declarations in the DTD.
 NamedNodeMap getEntities()
          A NamedNodeMap containing the general entities, both external and internal, declared in the DTD.
 java.lang.String getInternalSubset()
          Gets the internal subset of the DTD
 java.lang.String getName()
          Gets the name of the DTD; i.e., the name immediately following the DOCTYPE keyword.
 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
 NamedNodeMap getNotations()
          A NamedNodeMap containing the notations declared in the DTD.
 Document getOwnerDocument()
          Gets the Document object associated with this node.
 java.lang.String getPublicId()
          Gets The public identifier associated with the DTD, if specified.
 java.lang.String getRootTag()
          Get the root tag for the DTD
 java.lang.String getSystemId()
          Gets the system identifier associated with the DTD, if specified.
 boolean hasChildNodes()
          This is a convenience method to allow easy determination of whether a node has any children. return false always, as DTD cannot have any overrides method in XMLNode
 Node insertBefore(Node newChild, Node refChild)
          Inserts the node newChild before the existing child node refChild.
 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.
 void readExternal(java.io.ObjectInput inArg)
          This method reads the information written in the compressed stream by writeExternal method and restores the object correspondingly.
 Node replaceChild(Node newChild, Node oldChild)
          Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.
 void setRootTag(java.lang.String root)
          Set the root tag for the DTD
 void writeExternal(java.io.ObjectOutput outArg)
          This method saves the state of the object by creating a binray compressed stream with information about this object.

 

Methods inherited from class oracle.xml.parser.v2.XMLNode
addEventListener, addText, appendChild, canAppendChild, canInsertBefore, canRemoveChild, canReplaceChild, cloneNode, dispatchEvent, equals, getAttributes, getChildNodes, getColumnNumber, getDebugMode, getDefaultValue, getEnumeratedValues, getFirstChild, getFirstChildAsOffset, getLastChild, getLineNumber, getLocalName, getNamespaceURI, getNextSibling, getNextSiblingAsOffset, getNodeValue, getNodeValueAsBinaryStream, getNodeValueAsBinaryStream, getNodeValueAsCharacterStream, getNodeValueAsCharacterStream, getParentNode, getPrefix, getPreviousSibling, getPrimitiveTypeId, getProperty, getText, getXMLError, hasAttributes, hashCode, isDocumentFlag, isNodeFlag, isSupported, nodeValidity, normalize, print, print, print, print, removeChild, removeEventListener, reportSAXEvents, resetNodeFlag, selectNodes, selectNodes, selectSingleNode, selectSingleNode, setDebugInfo, setNodeFlag, setNodeFlag, setNodeFlag, setNodeValue, setNodeValueAsBinaryStream, setNodeValueAsBinaryStream, setNodeValueAsCharacterStream, setNodeValueAsCharacterStream, setPrefix, setProperty, transformNode, valueOf, valueOf, xdbGetNodeId

 

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

 

Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeValue, getParentNode, getPrefix, getPreviousSibling, hasAttributes, isSupported, normalize, removeChild, setNodeValue, setPrefix

 

Constructor Detail

DTD

public DTD()
Default constructor. Note that this constructor is used only during deserialization/decompression of this DOM node. In order to deserialize this node to construct the DOM node from the serialized/ compressed stream, it is required to create a handle of the object.

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

getName

public java.lang.String getName()
Gets the name of the DTD; i.e., the name immediately following the DOCTYPE keyword.
Specified by:
getName in interface DocumentType
Returns:
Name of the DTD

getEntities

public NamedNodeMap getEntities()
A NamedNodeMap containing the general entities, both external and internal, declared in the DTD. Duplicates are discarded. For example in:<!DOCTYPE ex SYSTEM "ex.dtd" [ <!ENTITY foo "foo"> <!ENTITY bar "bar"> <!ENTITY % baz "baz">]> <ex/> the interface provides access to foo and bar but not baz. Every node in this map also implements the Entity interface.
The DOM Level 1 does not support editing entities, therefore entities cannot be altered in any way.
Specified by:
getEntities in interface DocumentType
Returns:
The entities declared in the DTD

getNotations

public NamedNodeMap getNotations()
A NamedNodeMap containing the notations declared in the DTD. Duplicates are discarded. Every node in this map also implements the Notation interface.
The DOM Level 1 does not support editing notations, therefore notations cannot be altered in any way.
Specified by:
getNotations in interface DocumentType
Returns:
The notations declared in the DTD

getElementDecls

public NamedNodeMap getElementDecls()
A NamedNodeMap containing the element declarations in the DTD. Every node in this map is an ElementDecl object.
Returns:
The element declarations in the DTD
The DOM Level 1 does not support editing elementdecls, therefore elementdecls cannot be altered in any way.

hasChildNodes

public boolean hasChildNodes()
This is a convenience method to allow easy determination of whether a node has any children. return false always, as DTD cannot have any overrides method in XMLNode
Specified by:
hasChildNodes in interface Node
Overrides:
hasChildNodes in class XMLNode
Returns:
false as DTD node can not have any children,

getPublicId

public java.lang.String getPublicId()
Gets The public identifier associated with the DTD, if specified. If the public identifier was not specified, this is null.
Specified by:
getPublicId in interface DocumentType
Returns:
the public identifier associated with the DTD

getSystemId

public java.lang.String getSystemId()
Gets the system identifier associated with the DTD, if specified. If the system identifier was not specified, this is null.
Specified by:
getSystemId in interface DocumentType
Overrides:
getSystemId in class XMLNode
Returns:
the system identifier associated with the DTD

getInternalSubset

public java.lang.String getInternalSubset()
Gets the internal subset of the DTD
Specified by:
getInternalSubset in interface DocumentType
Returns:
the internal subset declarations as a string

getOwnerDocument

public Document getOwnerDocument()
Gets the Document object associated with this node. This is also the Document object used to create new nodes. When this node is a Document this is null.
Specified by:
getOwnerDocument in interface Node
Overrides:
getOwnerDocument in class XMLNode
Returns:
The document associated with this node

setRootTag

public void setRootTag(java.lang.String root)
Set the root tag for the DTD
Parameters:
root - the root tag

getRootTag

public java.lang.String getRootTag()
Get the root tag for the DTD
Returns:
root tag

findEntity

public final Entity findEntity(java.lang.String name,
                               boolean isPE)
Finds a named entity in the DTD.
Parameters:
name - The name of the entity.
isPE - Is this a parameter entity (as opposed to a general entity)?
Returns:
the specified Entity object; returns null if it is not found.

findElementDecl

public final ElementDecl findElementDecl(java.lang.String name)
Finds an element declaration for the given tag name.
Parameters:
name - The tag name.
Returns:
the element declaration object.

findNotation

public final Notation findNotation(java.lang.String name)
Retrieves the named notation from the DTD.
Parameters:
name - The name of the notation.
Returns:
the Notation object; returns null if it is not found.

convertDTD2Schema

public XMLDocument convertDTD2Schema()
get XML Schema DOM tree from this DTD object
Returns:
converted XML Schema Document

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

writeExternal

public void writeExternal(java.io.ObjectOutput outArg)
                   throws java.io.IOException
This method saves the state of the object by creating a binray compressed stream with information about this object.
Specified by:
writeExternal in interface java.io.Externalizable
Overrides:
writeExternal in class XMLNode
Parameters:
outArg - The ObjectOutput stream used to write the serialized/ compressed stream.
Throws:
java.io.IOException - is thrown when there is an exception while writing the serialized/compressed stream.

readExternal

public void readExternal(java.io.ObjectInput inArg)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
This method reads the information written in the compressed stream by writeExternal method and restores the object correspondingly.
Specified by:
readExternal in interface java.io.Externalizable
Overrides:
readExternal in class XMLNode
Parameters:
inArg - the ObjectInput stream used for reading the compressed stream.
Throws:
java.io.IOException - is thrown when there is an error in reading the input stream.
java.lang.ClassNotFoundException - is thrown when the class is not found.

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

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.
Specified by:
replaceChild in interface Node
Overrides:
replaceChild in class XMLNode
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, or it the node to put in 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 oldChild is not a child of this node.

Skip navigation links

Oracle® Database XML Java API Reference
12c Release 1 (12.1)

E15981-09


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