Skip navigation links

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

## oracle.xml.parser.v2
Class DTD

`java.lang.Object
oracle.xml.parser.v2.XMLNode
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 n, boolean par)` 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
`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.
`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, insertBefore, isDocumentFlag, isNodeFlag, isSupported, nodeValidity, normalize, print, print, print, print, removeChild, removeEventListener, replaceChild, 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
`clone, finalize, 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, insertBefore, isSupported, normalize, removeChild, replaceChild, 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 n,
                                   boolean par)

  Finds a named entity in the DTD.
  Parameters:
    `n` - The name of the 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.

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.