XML for Java EA2

com.ibm.xml.dom
Class DocumentTypeImpl

java.lang.Object
  |
  +--com.ibm.xml.dom.NodeImpl
        |
        +--com.ibm.xml.dom.DocumentTypeImpl
Direct Known Subclasses:
DeferredDocumentTypeImpl

public class DocumentTypeImpl
extends NodeImpl
implements DocumentType

This class represents a Document Type declaraction in the document itself, not a Document Type Definition (DTD). An XML document may (or may not) have such a reference.

DocumentType is an Extended DOM feature, used in XML documents but not in HTML.

Note that Entities and Notations are no longer children of the DocumentType, but are parentless nodes hung only in their appropriate NamedNodeMaps.

This area is UNDERSPECIFIED IN REC-DOM-Level-1-19981001 Most notably, absolutely no provision was made for storing and using Element and Attribute information. Nor was the linkage between Entities and Entity References nailed down solidly.

Since:
PR-DOM-Level-1-19980818.
Version:
Revision: 57 1.8 src/com/ibm/xml/dom/DocumentTypeImpl.java, parser, xml4j2, xml4j2_0_13
See Also:
Serialized Form

Field Summary
protected  NamedNodeMapImpl elements
          Elements.
protected  NamedNodeMapImpl entities
          Entities.
protected  NamedNodeMapImpl notations
          Notations.
protected  java.lang.String publicID
           
protected  java.lang.String systemID
           
 
Fields inherited from class com.ibm.xml.dom.NodeImpl
ELEMENT_DEFINITION_NODE, firstChild, kidOK, lastChild, name, nextSibling, ownerDocument, parentNode, previousSibling, readOnly, syncChildren, syncData, userData, value
 
Constructor Summary
DocumentTypeImpl(DocumentImpl ownerDocument, java.lang.String name)
          Factory method for creating a document type node.
DocumentTypeImpl(DocumentImpl ownerDocument, java.lang.String name, java.lang.String publicID, java.lang.String systemID)
          Factory method for creating a document type node.
 
Method Summary
 Node cloneNode(boolean deep)
          Clones the node.
 NamedNodeMap getElements()
          NON-DOM: Access the collection of ElementDefinitions.
 NamedNodeMap getEntities()
          Access the collection of general Entities, both external and internal, defined in the DTD.
 java.lang.String getName()
          Name of this document type.
 short getNodeType()
          A short integer indicating what type of node this is.
 NamedNodeMap getNotations()
          Access the collection of Notations defined in the DTD.
 java.lang.String getPublicID()
          Introduced in DOM Level 2.
 java.lang.String getSystemID()
          Introduced in DOM Level 2.
 void setNodeValue(java.lang.String value)
          DocumentTypes never have a nodeValue.
 void setReadOnly(boolean readOnly, boolean deep)
          NON-DOM: Subclassed to flip the entities' and notations' readonly switch as well.
 
Methods inherited from class com.ibm.xml.dom.NodeImpl
appendChild, changed, getAttributes, getChildNodes, getFirstChild, getLastChild, getLength, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getReadOnly, getUserData, hasChildNodes, insertBefore, item, removeChild, replaceChild, setPrefix, setUserData, supports, synchronizeChildren, synchronizeData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

entities

protected NamedNodeMapImpl entities
Entities.

notations

protected NamedNodeMapImpl notations
Notations.

elements

protected NamedNodeMapImpl elements
Elements.

publicID

protected java.lang.String publicID

systemID

protected java.lang.String systemID
Constructor Detail

DocumentTypeImpl

public DocumentTypeImpl(DocumentImpl ownerDocument,
                        java.lang.String name)
Factory method for creating a document type node.

DocumentTypeImpl

public DocumentTypeImpl(DocumentImpl ownerDocument,
                        java.lang.String name,
                        java.lang.String publicID,
                        java.lang.String systemID)
Factory method for creating a document type node.
Method Detail

getPublicID

public java.lang.String getPublicID()
Introduced in DOM Level 2.

Return the public identifier of this Document type.

Since:
WD-DOM-Level-2-19990923

getSystemID

public java.lang.String getSystemID()
Introduced in DOM Level 2.

Return the system identifier of this Document type.

Since:
WD-DOM-Level-2-19990923

getNodeType

public short getNodeType()
A short integer indicating what type of node this is. The named constants for this value are defined in the org.w3c.dom.Node interface.
Overrides:
getNodeType in class NodeImpl

setNodeValue

public void setNodeValue(java.lang.String value)
                  throws DOMException
DocumentTypes never have a nodeValue.
Throws:
DOMException(NO_MODIFICATION_ALLOWED_ERR) -  
Overrides:
setNodeValue in class NodeImpl

cloneNode

public Node cloneNode(boolean deep)
Clones the node.
Overrides:
cloneNode in class NodeImpl

getName

public java.lang.String getName()
Name of this document type. If we loaded from a DTD, this should be the name immediately following the DOCTYPE keyword.
Specified by:
getName in interface DocumentType

getEntities

public NamedNodeMap getEntities()
Access the collection of general Entities, both external and internal, defined in the DTD. For example, in:

   <!doctype example SYSTEM "ex.dtd" [
     <!ENTITY foo "foo">
     <!ENTITY bar "bar">
     <!ENTITY % baz "baz">
     ]>
 

The Entities map includes foo and bar, but not baz. It is promised that only Nodes which are Entities will exist in this NamedNodeMap.

For HTML, this will always be null.

Note that "built in" entities such as & and < should be converted to their actual characters before being placed in the DOM's contained text, and should be converted back when the DOM is rendered as XML or HTML, and hence DO NOT appear here.

Specified by:
getEntities in interface DocumentType

getNotations

public NamedNodeMap getNotations()
Access the collection of Notations defined in the DTD. A notation declares, by name, the format of an XML unparsed entity or is used to formally declare a Processing Instruction target.
Specified by:
getNotations in interface DocumentType

setReadOnly

public void setReadOnly(boolean readOnly,
                        boolean deep)
NON-DOM: Subclassed to flip the entities' and notations' readonly switch as well.
Overrides:
setReadOnly in class NodeImpl
See Also:
NodeImpl.setReadOnly

getElements

public NamedNodeMap getElements()
NON-DOM: Access the collection of ElementDefinitions.
See Also:
ElementDefinitionImpl

XML for Java EA2