org.ozoneDB.xml.dom
Class DocumentTypeImpl

java.lang.Object
  extended byorg.ozoneDB.OzoneObject
      extended byorg.ozoneDB.xml.dom.NodeImpl
          extended byorg.ozoneDB.xml.dom.DocumentImpl
              extended byorg.ozoneDB.xml.dom.DocumentTypeImpl
All Implemented Interfaces:
org.w3c.dom.Document, DocumentProxy, org.w3c.dom.DocumentType, DocumentTypeProxy, org.w3c.dom.DOMImplementation, java.io.Externalizable, org.w3c.dom.Node, NodeProxy, org.ozoneDB.OzoneCompatible, org.ozoneDB.OzoneCompatibleOrProxy, org.ozoneDB.OzoneRemote, java.io.Serializable
Direct Known Subclasses:
DTDDocument

public class DocumentTypeImpl
extends DocumentImpl
implements DocumentTypeProxy

Each document Document.getDoctype() attribute whose value is either null or an object that represents the document type definition (DTD). HTML documents do not have a DTD. At the moment, this object provides the list of entities that are defined for the document and little else. Access is provided through NamedNodeMap collections.

Notes:

  1. Node type is Node.DOCUMENT_TYPE_NODE
  2. Does not support childern
  3. Node does not have a value
  4. Node does not have parents or siblings and is only accessible from Document

The internal implementation also provides access to other elements that are part of the DTD, so full XML documents can be generated and parsed. These extensions are beyond the DOM API and are covered in an extended API. For more information see DTDDocument.

Version:
$Revision: 1.2 $ $Date: 2003/11/20 23:18:42 $
Author:
Assaf Arkin
See Also:
DocumentType, DTDDocument, NodeImpl, NamedNodeMap, Serialized Form

Field Summary
 
Fields inherited from class org.ozoneDB.xml.dom.NodeImpl
ATTLIST_DECL_NODE, ELEMENT_DECL_NODE, PARAM_ENTITY_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
 
Constructor Summary
DocumentTypeImpl()
           
DocumentTypeImpl(org.w3c.dom.Document owner, java.lang.String rootElement, boolean standalone, java.lang.String systemId, java.lang.String publicId)
           
DocumentTypeImpl(java.lang.String systemId)
           
 
Method Summary
protected  org.w3c.dom.Node castNewChild(org.w3c.dom.Node newChild)
          Checks whether newChild can be added to this node as a child, and if so, performs a necessary cast.
 java.lang.Object clone()
           
 void cloneInto(NodeProxy into, boolean deep)
          This clone method is called after a new node has been constructed to copy the contents of this node into the new one.
 org.w3c.dom.Node cloneNode(boolean deep)
           
 org.w3c.dom.Entity createEntity(java.lang.String name, java.lang.String value)
          Creates a new internal entity declaration and returns it.
 org.w3c.dom.Entity createEntity(java.lang.String name, java.lang.String systemID, java.lang.String publicID)
          Creates a new external general entity declaration and returns it.
 org.w3c.dom.Entity createEntity(java.lang.String name, java.lang.String systemID, java.lang.String publicID, java.lang.String notation)
          Creates a new unparsed general entity declaration and returns it.
 org.w3c.dom.Notation createNotation(java.lang.String name, java.lang.String systemID, java.lang.String publicID)
          Creates a new notation and returns it.
 ParamEntity createParamEntity(java.lang.String name, java.lang.String value)
          Creates a new internal parameter and returns it.
 ParamEntity createParamEntity(java.lang.String name, java.lang.String systemID, java.lang.String publicID)
          Creates a new external parameter entity and returns it.
 org.w3c.dom.Entity declareEntity(org.w3c.dom.Entity general)
          Declares a new general entity declaration.
 org.w3c.dom.Notation declareNotation(org.w3c.dom.Notation notation)
          Declares a new notation.
 ParamEntity declareParamEntity(ParamEntity param)
          Declares a new parameter entity.
 boolean equals(java.lang.Object other)
           
 org.w3c.dom.Entity findEntity(java.lang.String name)
          Returns the named general entity declaration if one has been declared.
 org.w3c.dom.Notation findNotation(java.lang.String name)
          Returns the named notation if one has been declared.
 ParamEntity findParamEntity(java.lang.String name)
          Returns the named parameter entity if one has been declared.
 org.w3c.dom.Element getDocumentElement()
           
 org.w3c.dom.NamedNodeMap getEntities()
           
 java.lang.String getInternalSubset()
           
 java.lang.String getName()
           
 short getNodeType()
          Abstract method must be implemented by each node class.
 org.w3c.dom.NamedNodeMap getNotations()
           
 java.util.Dictionary getParamEntities()
          Returns a dictionary of all the parameter entitites declared in this DTD.
 java.util.Hashtable getParams()
           
 java.lang.String getPublicId()
           
 boolean getStandalone()
           
 java.lang.String getSystemId()
           
 void init(java.lang.String systemId)
           
 java.lang.String internalAsText()
           
 boolean isStandalone()
           
 void setEntities(org.w3c.dom.NamedNodeMap entities)
           
 void setNotations(org.w3c.dom.NamedNodeMap notations)
           
 void setParams(java.util.Hashtable params)
           
 void setPublicId(java.lang.String publicId)
           
 void setStandalone(boolean standalone)
           
 void setSystemId(java.lang.String systemId)
           
 java.lang.String toString()
           
 
Methods inherited from class org.ozoneDB.xml.dom.DocumentImpl
acquire, assignDoctype, clearDocument, createAttribute, createAttribute, createAttributeNS, createCDATASection, createComment, createDocument, createDocumentFragment, createDocumentType, createElement, createElementNS, createEntityReference, createProcessingInstruction, createTextNode, getContainer, getDoctype, getElementById, getElementsByTagName, getElementsByTagNameNS, getImplementation, hasFeature, importNode, lock, onDelete, readExternal, registerElement, setContainer, setDoctype, setElementTypes, setNodeValue, supportsChildern, unlock, writeExternal
 
Methods inherited from class org.ozoneDB.xml.dom.NodeImpl
appendChild, castOldChild, getAttributes, getChild, getChildCount, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, init, insertBefore, isReadOnly, isSupported, normalize, notifyIterators, removeChild, replaceChild, setNextSibling, setNodeName, setOwnerDocument, setParentNode, setPrefix, setPreviousSibling, setReadOnly, supports
 
Methods inherited from class org.ozoneDB.OzoneObject
container, database, deleteRecursive, getHandle, getObjectID, handle, hashCode, onActivate, onCreate, onPassivate, requireWriteLocking, self, setContainer, toXML
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.ozoneDB.OzoneCompatibleOrProxy
getObjectID
 
Methods inherited from interface org.w3c.dom.Node
appendChild, getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, removeChild, replaceChild, setNodeValue, setPrefix
 
Methods inherited from interface org.ozoneDB.xml.dom.DocumentProxy
clearDocument, getContainer, setContainer, setDoctype, setElementTypes
 
Methods inherited from interface org.w3c.dom.Document
createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createElement, createElementNS, createEntityReference, createProcessingInstruction, createTextNode, getDoctype, getElementById, getElementsByTagName, getElementsByTagNameNS, getImplementation, importNode
 
Methods inherited from interface org.w3c.dom.DOMImplementation
createDocument, createDocumentType, hasFeature
 
Methods inherited from interface org.ozoneDB.xml.dom.NodeProxy
getChild, getChildCount, getChildNodes, init, isReadOnly, setNextSibling, setNodeName, setOwnerDocument, setParentNode, setPreviousSibling, setReadOnly
 

Constructor Detail

DocumentTypeImpl

public DocumentTypeImpl(java.lang.String systemId)

DocumentTypeImpl

public DocumentTypeImpl(org.w3c.dom.Document owner,
                        java.lang.String rootElement,
                        boolean standalone,
                        java.lang.String systemId,
                        java.lang.String publicId)

DocumentTypeImpl

public DocumentTypeImpl()
Method Detail

getInternalSubset

public java.lang.String getInternalSubset()
Specified by:
getInternalSubset in interface org.w3c.dom.DocumentType

getNodeType

public short getNodeType()
Description copied from class: NodeImpl
Abstract method must be implemented by each node class.

Specified by:
getNodeType in interface org.w3c.dom.Node
Overrides:
getNodeType in class DocumentImpl

getName

public java.lang.String getName()
Specified by:
getName in interface org.w3c.dom.DocumentType

getEntities

public org.w3c.dom.NamedNodeMap getEntities()
Specified by:
getEntities in interface DocumentTypeProxy

setEntities

public void setEntities(org.w3c.dom.NamedNodeMap entities)
Specified by:
setEntities in interface DocumentTypeProxy

getNotations

public org.w3c.dom.NamedNodeMap getNotations()
Specified by:
getNotations in interface DocumentTypeProxy

setNotations

public void setNotations(org.w3c.dom.NamedNodeMap notations)
Specified by:
setNotations in interface DocumentTypeProxy

getParams

public java.util.Hashtable getParams()
Specified by:
getParams in interface DocumentTypeProxy

setParams

public void setParams(java.util.Hashtable params)
Specified by:
setParams in interface DocumentTypeProxy

getPublicId

public java.lang.String getPublicId()
Specified by:
getPublicId in interface DocumentTypeProxy

setSystemId

public void setSystemId(java.lang.String systemId)
Specified by:
setSystemId in interface DocumentTypeProxy

setPublicId

public void setPublicId(java.lang.String publicId)
Specified by:
setPublicId in interface DocumentTypeProxy

getSystemId

public java.lang.String getSystemId()
Specified by:
getSystemId in interface DocumentTypeProxy

internalAsText

public java.lang.String internalAsText()

getStandalone

public boolean getStandalone()
Specified by:
getStandalone in interface DocumentTypeProxy

setStandalone

public void setStandalone(boolean standalone)
Specified by:
setStandalone in interface DocumentTypeProxy

createEntity

public org.w3c.dom.Entity createEntity(java.lang.String name,
                                       java.lang.String systemID,
                                       java.lang.String publicID)
Creates a new external general entity declaration and returns it.

Parameters:
name - The notation name
systemID - The system identifier
publicID - The public identifier
Returns:
Returns a new entity node

createEntity

public org.w3c.dom.Entity createEntity(java.lang.String name,
                                       java.lang.String systemID,
                                       java.lang.String publicID,
                                       java.lang.String notation)
Creates a new unparsed general entity declaration and returns it.

Parameters:
name - The notation name
systemID - The system identifier
publicID - The public identifier
notation - The notation
Returns:
Returns a new entity node

createEntity

public org.w3c.dom.Entity createEntity(java.lang.String name,
                                       java.lang.String value)
Creates a new internal entity declaration and returns it. The entity value is given after parameter entity and character reference substitution.

Parameters:
name - The notation name
value - The entity value
Returns:
Returns a new entity node

declareEntity

public org.w3c.dom.Entity declareEntity(org.w3c.dom.Entity general)
Declares a new general entity declaration. If a general entity with the same name is already declared, it remains intact and the existing entity is returned. If no such entity exists, the entity is declared and returned.

Parameters:
general - The general entity to declare
Returns:
The declared entity

findEntity

public org.w3c.dom.Entity findEntity(java.lang.String name)
Returns the named general entity declaration if one has been declared.

Parameters:
name - The entity name
Returns:
The named general entity

createNotation

public org.w3c.dom.Notation createNotation(java.lang.String name,
                                           java.lang.String systemID,
                                           java.lang.String publicID)
Creates a new notation and returns it. Notation must have either or both system and public identifiers.

Parameters:
name - The notation name
systemID - The system identifier
publicID - The public identifier
Returns:
Returns a new notation node

declareNotation

public org.w3c.dom.Notation declareNotation(org.w3c.dom.Notation notation)
Declares a new notation. If a notation with the same name is already declared, it remains intact and the existing notation is returned. If no such notation exists, the notation is declared and returned.

Parameters:
notation - The notation to declare
Returns:
The declared notation

findNotation

public org.w3c.dom.Notation findNotation(java.lang.String name)
Returns the named notation if one has been declared.

Parameters:
name - The notation name
Returns:
The named notation

createParamEntity

public ParamEntity createParamEntity(java.lang.String name,
                                     java.lang.String systemID,
                                     java.lang.String publicID)
Creates a new external parameter entity and returns it.

Parameters:
name - The notation name
systemID - The system identifier
publicID - The public identifier
Returns:
Returns a new entity node

createParamEntity

public ParamEntity createParamEntity(java.lang.String name,
                                     java.lang.String value)
Creates a new internal parameter and returns it. The entity value is given after character reference substitution.

Parameters:
name - The notation name
value - The entity value
Returns:
Returns a new entity node

declareParamEntity

public ParamEntity declareParamEntity(ParamEntity param)
Declares a new parameter entity. If a parameter entity with the same name is already declared, it remains intact and the existing entity is returned. If no such entity exists, the entity is declared and returned.

Parameters:
param - The parameter entity to declare
Returns:
The declared entity

findParamEntity

public ParamEntity findParamEntity(java.lang.String name)
Returns the named parameter entity if one has been declared.

Parameters:
name - The entity name
Returns:
The named parameter entity

getParamEntities

public java.util.Dictionary getParamEntities()
Returns a dictionary of all the parameter entitites declared in this DTD. If no PEs were declared, null is returned.

Returns:
Dictionary of param entities, or null

isStandalone

public boolean isStandalone()

getDocumentElement

public org.w3c.dom.Element getDocumentElement()
Specified by:
getDocumentElement in interface org.w3c.dom.Document
Overrides:
getDocumentElement in class DocumentImpl

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class DocumentImpl

clone

public java.lang.Object clone()
Specified by:
clone in interface DocumentTypeProxy
Overrides:
clone in class DocumentImpl

cloneNode

public org.w3c.dom.Node cloneNode(boolean deep)
Specified by:
cloneNode in interface org.w3c.dom.Node
Overrides:
cloneNode in class DocumentImpl

toString

public java.lang.String toString()
Overrides:
toString in class DocumentImpl

cloneInto

public void cloneInto(NodeProxy into,
                      boolean deep)
Description copied from class: NodeImpl
This clone method is called after a new node has been constructed to copy the contents of this node into the new one. It clones in contents but not in context, and guarantees that the cloned node will pass the equality test (see OzoneObject.equals(java.lang.Object)).

into must be a valid node of the exact same class as this one. deep is true if deep cloning (includes all children nodes) is to be performed. If deep is false, the clone might not pass the equality test.

Derived classes override and call this method to add per-class variable copying. This method is called by Node.cloneNode(boolean) and the default Object.clone() method.

Contents cloning duplicates the node's name and value, and its children. It does not duplicate it's context, that is, the node's parent or sibling. Initially a clone node has no parents or siblings. However, the node does belong to the same document, since all nodes must belong to some document. The cloned node is never read-only.

Specified by:
cloneInto in interface NodeProxy
Overrides:
cloneInto in class DocumentImpl

castNewChild

protected org.w3c.dom.Node castNewChild(org.w3c.dom.Node newChild)
                                 throws org.w3c.dom.DOMException
Description copied from class: NodeImpl
Checks whether newChild can be added to this node as a child, and if so, performs a necessary cast. newChild cannot be null and must belong to this DOM. It is impossible to transfer nodes between different DOM implementations.

The following rules govern the allowed newChild types:

Any deviation will throw an exception.

Overrides:
castNewChild in class NodeImpl
Parameters:
newChild - New child node
Returns:
newChild cast to type NodeImpl
Throws:
org.w3c.dom.DOMException - HIERARCHY_REQUEST_ERR newChild is null, does not belong to this DOM, or its node type is not supported for this parent

init

public void init(java.lang.String systemId)
Specified by:
init in interface DocumentTypeProxy


Copyright © 2004 The Ozone Database Project - www.ozone-db.org. All Rights Reserved.