org.apache.xerces.dom

Class DocumentTypeImpl

Implemented Interfaces:
Cloneable, org.w3c.dom.DocumentType, org.w3c.dom.events.EventTarget, org.w3c.dom.Node, org.w3c.dom.NodeList, Serializable
Known Direct Subclasses:
DeferredDocumentTypeImpl

public class DocumentTypeImpl
extends ParentNode
implements org.w3c.dom.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.

Version:
$Id: DocumentTypeImpl.java 380043 2006-02-23 05:23:19Z mrglavas $
Authors:
Arnaud Le Hors, IBM
Joe Kesselman, IBM
Andy Clark, IBM
Since:
PR-DOM-Level-1-19980818.

Field Summary

protected NamedNodeMapImpl
elements
Elements.
protected NamedNodeMapImpl
entities
Entities.
protected String
internalSubset
protected String
name
Document type name.
protected NamedNodeMapImpl
notations
Notations.
protected String
publicID
protected String
systemID

Fields inherited from class org.apache.xerces.dom.ParentNode

fNodeListCache, firstChild, ownerDocument

Fields inherited from class org.apache.xerces.dom.ChildNode

nextSibling, previousSibling

Fields inherited from class org.apache.xerces.dom.NodeImpl

DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_IS_CONTAINED, DOCUMENT_POSITION_PRECEDING, ELEMENT_DEFINITION_NODE, FIRSTCHILD, HASSTRING, ID, IGNORABLEWS, NORMALIZED, OWNED, READONLY, SPECIFIED, SYNCCHILDREN, SYNCDATA, TREE_POSITION_ANCESTOR, TREE_POSITION_DESCENDANT, TREE_POSITION_DISCONNECTED, TREE_POSITION_EQUIVALENT, TREE_POSITION_FOLLOWING, TREE_POSITION_PRECEDING, TREE_POSITION_SAME_NODE, flags, ownerNode

Fields inherited from interface org.w3c.dom.Node

ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE

Constructor Summary

DocumentTypeImpl(CoreDocumentImpl ownerDocument, String name)
Factory method for creating a document type node.
DocumentTypeImpl(CoreDocumentImpl ownerDocument, String qualifiedName, String publicID, String systemID)
Factory method for creating a document type node.

Method Summary

org.w3c.dom.Node
cloneNode(boolean deep)
Clones the node.
org.w3c.dom.NamedNodeMap
getElements()
NON-DOM: Access the collection of ElementDefinitions.
org.w3c.dom.NamedNodeMap
getEntities()
Access the collection of general Entities, both external and internal, defined in the DTD.
String
getInternalSubset()
Introduced in DOM Level 2.
String
getName()
Name of this document type.
String
getNodeName()
Returns the document type name
protected int
getNodeNumber()
NON-DOM Get the number associated with this doctype.
short
getNodeType()
A short integer indicating what type of node this is.
org.w3c.dom.NamedNodeMap
getNotations()
Access the collection of Notations defined in the DTD.
String
getPublicId()
Introduced in DOM Level 2.
String
getSystemId()
Introduced in DOM Level 2.
String
getTextContent()
Object
getUserData(String key)
protected Hashtable
getUserDataRecord()
boolean
isEqualNode(org.w3c.dom.Node arg)
DOM Level 3 WD- Experimental.
void
setInternalSubset(String internalSubset)
NON-DOM.
protected void
setOwnerDocument(CoreDocumentImpl doc)
NON-DOM set the ownerDocument of this node and its children
void
setReadOnly(boolean readOnly, boolean deep)
NON-DOM: Subclassed to flip the entities' and notations' readonly switch as well.
void
setTextContent(String textContent)
Object
setUserData(String key, Object data, org.w3c.dom.UserDataHandler handler)

Methods inherited from class org.apache.xerces.dom.ParentNode

cloneNode, getChildNodes, getChildNodesUnoptimized, getFirstChild, getLastChild, getLength, getOwnerDocument, getTextContent, hasChildNodes, insertBefore, isEqualNode, item, normalize, removeChild, replaceChild, setOwnerDocument, setReadOnly, setTextContent, synchronizeChildren

Methods inherited from class org.apache.xerces.dom.ChildNode

cloneNode, getNextSibling, getParentNode, getPreviousSibling

Methods inherited from class org.apache.xerces.dom.NodeImpl

addEventListener, appendChild, changed, changes, cloneNode, compareDocumentPosition, compareTreePosition, dispatchEvent, getAttributes, getBaseURI, getChildNodes, getContainer, getFeature, getFirstChild, getLastChild, getLength, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeNumber, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getReadOnly, getTextContent, getUserData, getUserData, getUserDataRecord, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, item, lookupNamespaceURI, lookupPrefix, needsSyncChildren, normalize, removeChild, removeEventListener, replaceChild, setNodeValue, setOwnerDocument, setPrefix, setReadOnly, setTextContent, setUserData, setUserData, synchronizeData, toString

Field Details

elements

protected NamedNodeMapImpl elements
Elements.

entities

protected NamedNodeMapImpl entities
Entities.

internalSubset

protected String internalSubset

name

protected String name
Document type name.

notations

protected NamedNodeMapImpl notations
Notations.

publicID

protected String publicID

systemID

protected String systemID

Constructor Details

DocumentTypeImpl

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

DocumentTypeImpl

public DocumentTypeImpl(CoreDocumentImpl ownerDocument,
                        String qualifiedName,
                        String publicID,
                        String systemID)
Factory method for creating a document type node.

Method Details

cloneNode

public org.w3c.dom.Node cloneNode(boolean deep)
Clones the node.
Specified by:
cloneNode in interface org.w3c.dom.Node
Overrides:
cloneNode in interface ParentNode

getElements

public org.w3c.dom.NamedNodeMap getElements()
NON-DOM: Access the collection of ElementDefinitions.

getEntities

public org.w3c.dom.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 org.w3c.dom.DocumentType

getInternalSubset

public String getInternalSubset()
Introduced in DOM Level 2.

Return the internalSubset given as a string.

Specified by:
getInternalSubset in interface org.w3c.dom.DocumentType
Since:
WD-DOM-Level-2-19990923

getName

public 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 org.w3c.dom.DocumentType

getNodeName

public String getNodeName()
Returns the document type name
Specified by:
getNodeName in interface org.w3c.dom.Node
Overrides:
getNodeName in interface NodeImpl

getNodeNumber

protected int getNodeNumber()
NON-DOM Get the number associated with this doctype.
Overrides:
getNodeNumber in interface NodeImpl

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.
Specified by:
getNodeType in interface org.w3c.dom.Node
Overrides:
getNodeType in interface NodeImpl

getNotations

public org.w3c.dom.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 org.w3c.dom.DocumentType

getPublicId

public String getPublicId()
Introduced in DOM Level 2.

Return the public identifier of this Document type.

Specified by:
getPublicId in interface org.w3c.dom.DocumentType
Since:
WD-DOM-Level-2-19990923

getSystemId

public String getSystemId()
Introduced in DOM Level 2.

Return the system identifier of this Document type.

Specified by:
getSystemId in interface org.w3c.dom.DocumentType
Since:
WD-DOM-Level-2-19990923

getTextContent

public String getTextContent()
            throws org.w3c.dom.DOMException
Specified by:
getTextContent in interface org.w3c.dom.Node
Overrides:
getTextContent in interface ParentNode

getUserData

public Object getUserData(String key)
Specified by:
getUserData in interface org.w3c.dom.Node
Overrides:
getUserData in interface NodeImpl

getUserDataRecord

protected Hashtable getUserDataRecord()
Overrides:
getUserDataRecord in interface NodeImpl

isEqualNode

public boolean isEqualNode(org.w3c.dom.Node arg)
DOM Level 3 WD- Experimental. Override inherited behavior from ParentNodeImpl to support deep equal.
Specified by:
isEqualNode in interface org.w3c.dom.Node
Overrides:
isEqualNode in interface ParentNode

setInternalSubset

public void setInternalSubset(String internalSubset)
NON-DOM.

Set the internalSubset given as a string.


setOwnerDocument

protected void setOwnerDocument(CoreDocumentImpl doc)
NON-DOM set the ownerDocument of this node and its children
Overrides:
setOwnerDocument in interface ParentNode

setReadOnly

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

setTextContent

public void setTextContent(String textContent)
            throws org.w3c.dom.DOMException
Specified by:
setTextContent in interface org.w3c.dom.Node
Overrides:
setTextContent in interface ParentNode

setUserData

public Object setUserData(String key,
                          Object data,
                          org.w3c.dom.UserDataHandler handler)
Specified by:
setUserData in interface org.w3c.dom.Node
Overrides:
setUserData in interface NodeImpl

Copyright B) 1999-2006 The Apache Software Foundation. All Rights Reserved.