oracle.xml.parser.v2
Class DTD

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

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

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

See Also:
Serialized Form

Fields inherited from class oracle.xml.parser.v2.XMLNode
ATTRDECL, Auto_Events, capturing, DOMAttrModified, DOMCharacterDataModified, DOMNodeInserted, DOMNodeInsertedIntoDocument, DOMNodeRemoved, DOMNodeRemovedFromDocument, DOMSubtreeModified, ELEMENTDECL, 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 oracle.xml.comp.CXMLConstants
ATTR_DEF, ATTR_TOKEN, ATTRDECL_DEF, CDATA_DEF, CHAR_DEF, COMMENT_DEF, CXML_VERSION, cXMLFILE, cXMLFILE_LEN, DEBUG, DTD_DEF, ELEMENTDECL_DEF, END, ENTITY_DEF, ENTITYREF_DEF, META_ID_MAX, names, NOTATION_DEF, NS_DEF, NULLSTR, PI_DEF, PREFIX_DEF, TAG_DEF, TAG_TOKEN, TOKEN_ONLY, XMLDECL_DEF
 
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
 
Constructor Summary
DTD()
          Default constructor.
 
Method Summary
TypeMethod
 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.
 NodeList getChildNodes()
          A NodeList that contains all children of this node.
 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()
          The internal subset as a string.The actual content returned depends on how much information is available to the implementation.
 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 the DTD; i.e., the name immediately following the DOCTYPE keyword.
 short getNodeType()
          Gets a code representing the type of the underlying object
 NamedNodeMap getNotations()
          A NamedNodeMap containing the notations declared in the DTD.
 XMLDOMImplementation getOwnerImplementation()
           
 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.
 void normalize()
          Puts all Text nodes in the full depth of the sub-tree underneath this Node, including attribute nodes, into a "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodes.
 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)
          Input Pointer (First byte expected) : DTD_DEF (byte) Output Pointer (Last byte read) : Last child node
 void readExternal(oracle.xml.io.XMLObjectInput in, oracle.xml.comp.CXMLContext cxmlContext)
          This method reads the DTD content.
 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.
 void writeExternal(oracle.xml.io.XMLObjectOutput out, oracle.xml.comp.CXMLContext cxmlContext)
          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, appendChild, cloneNode, dispatchEvent, getAttributes, getColumnNumber, getDebugMode, getFirstChild, getLastChild, getLineNumber, getLocalName, getNamespace, getNamespaceURI, getNextSibling, getNodeLocalName, getNodePrefix, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getProperty, getText, hasAttributes, insertBefore, isNodeFlag, isSupported, print, print, print, readChildNodes, removeChild, removeEventListener, replaceChild, reportSAXEvents, resetNodeFlag, selectNodes, selectNodes, selectNodes, selectSingleNode, selectSingleNode, setDebugInfo, setNodeFlag, setNodeValue, setPrefix, setProperty, supports, transformNode, valueOf, valueOf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

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

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

getNodeName

public java.lang.String getNodeName()
Gets the name of the DTD; i.e., the name immediately following the DOCTYPE keyword.
Overrides:
getNodeName in class XMLNode
Returns:
Name of the DTD

getNodeType

public short getNodeType()
Gets a code representing the type of the underlying object
Overrides:
getNodeType in class XMLNode
Returns:
type of the node

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
Overrides:
hasChildNodes in class XMLNode
Returns:
false as DTD node can not have any children,

getChildNodes

public NodeList getChildNodes()
A NodeList that contains all children of this node. If there are no children, this is a NodeList containing no nodes. The content of the returned NodeList is "live" in the sense that, for instance, changes to the children of the node object that it was created from are immediately reflected in the nodes returned by the NodeList accessors; it is not a static snapshot of the content of the node. This is true for every NodeList, including the ones returned by the getElementsByTagName method.
Overrides:
getChildNodes in class XMLNode
Returns:
The children of this node

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.

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

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

getInternalSubset

public java.lang.String getInternalSubset()
Description copied from interface: DocumentType
The internal subset as a string.The actual content returned depends on how much information is available to the implementation. This may vary depending on various parameters, including the XML processor used to build the document.
Specified by:
getInternalSubset in interface DocumentType
Since:
DOM 2 returns the internal subset declarations as a string

getOwnerImplementation

public XMLDOMImplementation getOwnerImplementation()
Since:
DOM 2 returns the Implementation this DTD was created from

normalize

public void normalize()
Description copied from interface: Node
Puts all Text nodes in the full depth of the sub-tree underneath this Node, including attribute nodes, into a "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are neither adjacent Text nodes nor empty 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 document tree structure are to be used.In cases where the document contains CDATASections, the normalize operation alone may not be sufficient, since XPointers do not differentiate between Text nodes and CDATASection nodes.
Overrides:
normalize in class XMLNode
Since:
DOM 2 Implementation this DTD was created from

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:
out - 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.

writeExternal

public void writeExternal(oracle.xml.io.XMLObjectOutput out,
                          oracle.xml.comp.CXMLContext cxmlContext)
                   throws java.io.IOException
This method saves the state of the object by creating a binray compressed stream with information about this object.
Parameters:
out - The ObjectOutput stream used to write the serialized/ compressed stream.
cxmlContext - The context of the compressed output 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
Input Pointer (First byte expected) : DTD_DEF (byte) Output Pointer (Last byte read) : Last child node
Specified by:
readExternal in interface java.io.Externalizable
Overrides:
readExternal in class XMLNode

readExternal

public void readExternal(oracle.xml.io.XMLObjectInput in,
                         oracle.xml.comp.CXMLContext cxmlContext)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
This method reads the DTD content.
Overrides:
readExternal in class XMLNode
Parameters:
in - XMLObjectInput the input stream
cxmlContent - the serialization object content information
Throws:
java.io.IOException - is thrown when there is an error in reading the input stream.
classNotFoundException - is thrown when the class is not found.