APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.xerces.internal.dom

public Class DocumentTypeImpl

extends ParentNode
implements DocumentType
Class Inheritance
All Implemented Interfaces
org.w3c.dom.DocumentType, org.w3c.dom.Node
Known Direct Subclasses
com.sun.org.apache.xerces.internal.dom.DeferredDocumentTypeImpl
Imports
java.io.IOException, .ObjectInputStream, .ObjectOutputStream, .ObjectStreamField, java.util.HashMap, .Hashtable, .Map, org.w3c.dom.DOMException, .DocumentType, .NamedNodeMap, .Node, .UserDataHandler

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.

Authors
Arnaud Le Hors, IBM, Joe Kesselman, IBM, Andy Clark, IBM
Since
PR-DOM-Level-1-19980818.

Field Summary

Modifier and TypeField and Description
private int
doctypeNumber

The following are required for compareDocumentPosition

protected NamedNodeMapImpl
elements

Elements.

protected NamedNodeMapImpl
entities

Entities.

protected String
protected String
name

Document type name.

protected NamedNodeMapImpl
notations

Notations.

protected String
private static final ObjectStreamField[]
pack-priv static final long
protected String
private Map<String, ParentNode.UserDataRecord>
Inherited from com.sun.org.apache.xerces.internal.dom.ParentNode:
firstChildfNodeListCacheownerDocument

Constructor Summary

AccessConstructor and Description
public
DocumentTypeImpl(CoreDocumentImpl ownerDocument, String name)

Factory method for creating a document type node.

public
DocumentTypeImpl(CoreDocumentImpl ownerDocument, String qualifiedName, String publicID, String systemID)

Factory method for creating a document type node.

Method Summary

Modifier and TypeMethod and Description
public Node
public NamedNodeMap
getElements()

NON-DOM: Access the collection of ElementDefinitions.

public NamedNodeMap
getEntities()

Implements org.w3c.dom.DocumentType.getEntities.

Access the collection of general Entities, both external and internal, defined in the DTD.

public String
getInternalSubset()

Implements org.w3c.dom.DocumentType.getInternalSubset.

Introduced in DOM Level 2.

public String
getName()

Implements org.w3c.dom.DocumentType.getName.

Name of this document type.

public String
getNodeName()

Implements abstract com.sun.org.apache.xerces.internal.dom.NodeImpl.getNodeName.

Implements org.w3c.dom.Node.getNodeName.

Returns the document type name

protected int
getNodeNumber()

Overrides com.sun.org.apache.xerces.internal.dom.NodeImpl.getNodeNumber.

NON-DOM Get the number associated with this doctype.

public short
getNodeType()

Implements abstract com.sun.org.apache.xerces.internal.dom.NodeImpl.getNodeType.

Implements org.w3c.dom.Node.getNodeType.

A short integer indicating what type of node this is.

public NamedNodeMap
getNotations()

Implements org.w3c.dom.DocumentType.getNotations.

Access the collection of Notations defined in the DTD.

public String
getPublicId()

Implements org.w3c.dom.DocumentType.getPublicId.

Introduced in DOM Level 2.

public String
getSystemId()

Implements org.w3c.dom.DocumentType.getSystemId.

Introduced in DOM Level 2.

public String
getTextContent()

Overrides com.sun.org.apache.xerces.internal.dom.ParentNode.getTextContent.

Implements org.w3c.dom.Node.getTextContent.

This attribute returns the text content of this node and its descendants.

public Object
getUserData(String key)

Overrides com.sun.org.apache.xerces.internal.dom.NodeImpl.getUserData.

Implements org.w3c.dom.Node.getUserData.

Retrieves the object associated to a key on a this node.

protected Map<String, ParentNode.UserDataRecord>
public boolean
private void
public void
setInternalSubset(String internalSubset)

NON-DOM.

protected void
setOwnerDocument(CoreDocumentImpl doc)

Overrides com.sun.org.apache.xerces.internal.dom.ParentNode.setOwnerDocument.

NON-DOM set the ownerDocument of this node and its children

public void
setReadOnly(boolean readOnly, boolean deep)

Overrides com.sun.org.apache.xerces.internal.dom.ParentNode.setReadOnly.

NON-DOM: Subclassed to flip the entities' and notations' readonly switch as well.

public void
setTextContent(String textContent)

Overrides com.sun.org.apache.xerces.internal.dom.ParentNode.setTextContent.

Implements org.w3c.dom.Node.setTextContent.

This attribute returns the text content of this node and its descendants.

public Object
setUserData(String key, Object data, UserDataHandler handler)

Overrides com.sun.org.apache.xerces.internal.dom.NodeImpl.setUserData.

Implements org.w3c.dom.Node.setUserData.

Associate an object to a key on this node.

private void
Inherited from com.sun.org.apache.xerces.internal.dom.ParentNode:
checkNormalizationAfterInsertcheckNormalizationAfterRemovegetChildNodesgetChildNodesUnoptimizedgetFirstChildgetLastChildgetLengthgetOwnerDocumentgetTextContenthasChildNodeshasTextContentinsertBeforeinternalInsertBeforeinternalRemoveChilditemlastChildlastChildnormalizeownerDocumentremoveChildreplaceChildsynchronizeChildren

Field Detail

doctypeNumberback to summary
private int doctypeNumber

The following are required for compareDocumentPosition

elementsback to summary
protected NamedNodeMapImpl elements

Elements.

entitiesback to summary
protected NamedNodeMapImpl entities

Entities.

internalSubsetback to summary
protected String internalSubset
nameback to summary
protected String name

Document type name.

notationsback to summary
protected NamedNodeMapImpl notations

Notations.

publicIDback to summary
protected String publicID
serialPersistentFieldsback to summary
private static final ObjectStreamField[] serialPersistentFields
Serial Fields:
name:String
document type name
entities:NamedNodeMapImpl
entities
notations:NamedNodeMapImpl
notations
elements:NamedNodeMapImpl
elements
publicID:String
support public ID
systemID:String
support system ID
internalSubset:String
support internal subset
doctypeNumber:int
Doctype number
userData:Hashtable
user data
serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Hides com.sun.org.apache.xerces.internal.dom.ParentNode.serialVersionUID.

Serialization version.

systemIDback to summary
protected String systemID
userDataback to summary
private Map<String, ParentNode.UserDataRecord> userData

Constructor Detail

DocumentTypeImplback to summary
public DocumentTypeImpl(CoreDocumentImpl ownerDocument, String name)

Factory method for creating a document type node.

DocumentTypeImplback to summary
public DocumentTypeImpl(CoreDocumentImpl ownerDocument, String qualifiedName, String publicID, String systemID)

Factory method for creating a document type node.

Method Detail

cloneNodeback to summary
public Node cloneNode(boolean deep)

Overrides com.sun.org.apache.xerces.internal.dom.ParentNode.cloneNode.

Implements org.w3c.dom.Node.cloneNode.

Clones the node.

getElementsback to summary
public NamedNodeMap getElements()

NON-DOM: Access the collection of ElementDefinitions.

See Also
ElementDefinitionImpl
getEntitiesback to summary
public NamedNodeMap getEntities()

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

getInternalSubsetback to summary
public String getInternalSubset()

Implements org.w3c.dom.DocumentType.getInternalSubset.

Introduced in DOM Level 2.

Return the internalSubset given as a string.

Since
WD-DOM-Level-2-19990923
getNameback to summary
public String getName()

Implements org.w3c.dom.DocumentType.getName.

Name of this document type. If we loaded from a DTD, this should be the name immediately following the DOCTYPE keyword.

getNodeNameback to summary
public String getNodeName()

Implements abstract com.sun.org.apache.xerces.internal.dom.NodeImpl.getNodeName.

Implements org.w3c.dom.Node.getNodeName.

Returns the document type name

getNodeNumberback to summary
protected int getNodeNumber()

Overrides com.sun.org.apache.xerces.internal.dom.NodeImpl.getNodeNumber.

NON-DOM Get the number associated with this doctype.

getNodeTypeback to summary
public short getNodeType()

Implements abstract com.sun.org.apache.xerces.internal.dom.NodeImpl.getNodeType.

Implements org.w3c.dom.Node.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.

getNotationsback to summary
public NamedNodeMap getNotations()

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

getPublicIdback to summary
public String getPublicId()

Implements org.w3c.dom.DocumentType.getPublicId.

Introduced in DOM Level 2.

Return the public identifier of this Document type.

Since
WD-DOM-Level-2-19990923
getSystemIdback to summary
public String getSystemId()

Implements org.w3c.dom.DocumentType.getSystemId.

Introduced in DOM Level 2.

Return the system identifier of this Document type.

Since
WD-DOM-Level-2-19990923
getTextContentback to summary
public String getTextContent() throws DOMException

Overrides com.sun.org.apache.xerces.internal.dom.ParentNode.getTextContent.

Implements org.w3c.dom.Node.getTextContent.

Doc from org.w3c.dom.Node.getTextContent.

This attribute returns the text content of this node and its descendants. When it is defined to be null, setting it has no effect. On setting, any possible children this node may have are removed and, if it the new string is not empty or null, replaced by a single Text node containing the string this attribute is set to.
On getting, no serialization is performed, the returned string does not contain any markup. No whitespace normalization is performed and the returned string does not contain the white spaces in element content (see the attribute Text.isElementContentWhitespace). Similarly, on setting, no parsing is performed either, the input string is taken as pure textual content.
The string returned is made of the text content of this node depending on its type, as defined below:

Node/Content table
Node type Content
ELEMENT_NODE, ATTRIBUTE_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, DOCUMENT_FRAGMENT_NODE concatenation of the textContent attribute value of every child node, excluding COMMENT_NODE and PROCESSING_INSTRUCTION_NODE nodes. This is the empty string if the node has no children.
TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE nodeValue
DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE null
Exceptions
DOMException:
DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a DOMString variable on the implementation platform.
getUserDataback to summary
public Object getUserData(String key)

Overrides com.sun.org.apache.xerces.internal.dom.NodeImpl.getUserData.

Implements org.w3c.dom.Node.getUserData.

Doc from org.w3c.dom.Node.getUserData.

Retrieves the object associated to a key on a this node. The object must first have been set to this node by calling setUserData with the same key.

getUserDataRecordback to summary
protected Map<String, ParentNode.UserDataRecord> getUserDataRecord()

Overrides com.sun.org.apache.xerces.internal.dom.NodeImpl.getUserDataRecord.

Annotations
@Override
isEqualNodeback to summary
public boolean isEqualNode(Node arg)

Overrides com.sun.org.apache.xerces.internal.dom.ParentNode.isEqualNode.

Implements org.w3c.dom.Node.isEqualNode.

DOM Level 3 WD- Experimental. Override inherited behavior from ParentNodeImpl to support deep equal.

readObjectback to summary
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException

Hides com.sun.org.apache.xerces.internal.dom.ParentNode.readObject.

Doc from com.sun.org.apache.xerces.internal.dom.ParentNode.readObject.

Deserialize object.

Annotations
@SuppressWarnings:unchecked
setInternalSubsetback to summary
public void setInternalSubset(String internalSubset)

NON-DOM.

Set the internalSubset given as a string.

setOwnerDocumentback to summary
protected void setOwnerDocument(CoreDocumentImpl doc)

Overrides com.sun.org.apache.xerces.internal.dom.ParentNode.setOwnerDocument.

NON-DOM set the ownerDocument of this node and its children

setReadOnlyback to summary
public void setReadOnly(boolean readOnly, boolean deep)

Overrides com.sun.org.apache.xerces.internal.dom.ParentNode.setReadOnly.

NON-DOM: Subclassed to flip the entities' and notations' readonly switch as well.

See Also
NodeImpl#setReadOnly
setTextContentback to summary
public void setTextContent(String textContent) throws DOMException

Overrides com.sun.org.apache.xerces.internal.dom.ParentNode.setTextContent.

Implements org.w3c.dom.Node.setTextContent.

Doc from org.w3c.dom.Node.setTextContent.

This attribute returns the text content of this node and its descendants. When it is defined to be null, setting it has no effect. On setting, any possible children this node may have are removed and, if it the new string is not empty or null, replaced by a single Text node containing the string this attribute is set to.
On getting, no serialization is performed, the returned string does not contain any markup. No whitespace normalization is performed and the returned string does not contain the white spaces in element content (see the attribute Text.isElementContentWhitespace). Similarly, on setting, no parsing is performed either, the input string is taken as pure textual content.
The string returned is made of the text content of this node depending on its type, as defined below:

Node/Content table
Node type Content
ELEMENT_NODE, ATTRIBUTE_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, DOCUMENT_FRAGMENT_NODE concatenation of the textContent attribute value of every child node, excluding COMMENT_NODE and PROCESSING_INSTRUCTION_NODE nodes. This is the empty string if the node has no children.
TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE nodeValue
DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE null
Exceptions
DOMException:
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
setUserDataback to summary
public Object setUserData(String key, Object data, UserDataHandler handler)

Overrides com.sun.org.apache.xerces.internal.dom.NodeImpl.setUserData.

Implements org.w3c.dom.Node.setUserData.

Doc from org.w3c.dom.Node.setUserData.

Associate an object to a key on this node. The object can later be retrieved from this node by calling getUserData with the same key.

writeObjectback to summary
private void writeObject(ObjectOutputStream out) throws IOException

Hides com.sun.org.apache.xerces.internal.dom.ParentNode.writeObject.

Doc from com.sun.org.apache.xerces.internal.dom.ParentNode.writeObject.

Serialize object.

Serial data
Serialized fields. Convert Map to Hashtable for backward compatibility.