org.apache.xerces.dom

Class DocumentTypeImpl

public class DocumentTypeImpl extends ParentNode 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.

INTERNAL:

Usage of this class is not supported. It may be altered or removed at any time.

Since: PR-DOM-Level-1-19980818.

Version: $Id: DocumentTypeImpl.java,v 1.29 2005/05/02 22:02:22 mrglavas Exp $

Author: Arnaud Le Hors, IBM Joe Kesselman, IBM Andy Clark, IBM

Field Summary
protected NamedNodeMapImplelements
Elements.
protected NamedNodeMapImplentities
Entities.
protected StringinternalSubset
protected Stringname
Document type name.
protected NamedNodeMapImplnotations
Notations.
protected StringpublicID
protected StringsystemID
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
NodecloneNode(boolean deep)
Clones the node.
NamedNodeMapgetElements()
NON-DOM: Access the collection of ElementDefinitions.
NamedNodeMapgetEntities()
Access the collection of general Entities, both external and internal, defined in the DTD.
StringgetInternalSubset()
Introduced in DOM Level 2.
StringgetName()
Name of this document type.
StringgetNodeName()
Returns the document type name
protected intgetNodeNumber()
NON-DOM Get the number associated with this doctype.
shortgetNodeType()
A short integer indicating what type of node this is.
NamedNodeMapgetNotations()
Access the collection of Notations defined in the DTD.
StringgetPublicId()
Introduced in DOM Level 2.
StringgetSystemId()
Introduced in DOM Level 2.
StringgetTextContent()
ObjectgetUserData(String key)
protected HashtablegetUserDataRecord()
booleanisEqualNode(Node arg)
DOM Level 3 WD- Experimental.
voidsetInternalSubset(String internalSubset)
NON-DOM.
voidsetReadOnly(boolean readOnly, boolean deep)
NON-DOM: Subclassed to flip the entities' and notations' readonly switch as well.
voidsetTextContent(String textContent)
ObjectsetUserData(String key, Object data, UserDataHandler handler)

Field Detail

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 Detail

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 Detail

cloneNode

public Node cloneNode(boolean deep)
Clones the node.

getElements

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

See Also: ElementDefinitionImpl

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.

getInternalSubset

public String getInternalSubset()
Introduced in DOM Level 2.

Return the internalSubset given as a string.

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.

getNodeName

public String getNodeName()
Returns the document type name

getNodeNumber

protected int getNodeNumber()
NON-DOM Get the number associated with this doctype.

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.

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.

getPublicId

public String getPublicId()
Introduced in DOM Level 2.

Return the public identifier of this Document type.

Since: WD-DOM-Level-2-19990923

getSystemId

public String getSystemId()
Introduced in DOM Level 2.

Return the system identifier of this Document type.

Since: WD-DOM-Level-2-19990923

getTextContent

public String getTextContent()

getUserData

public Object getUserData(String key)

getUserDataRecord

protected Hashtable getUserDataRecord()

isEqualNode

public boolean isEqualNode(Node arg)
DOM Level 3 WD- Experimental. Override inherited behavior from ParentNodeImpl to support deep equal.

setInternalSubset

public void setInternalSubset(String internalSubset)
NON-DOM.

Set the internalSubset given as a string.

setReadOnly

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

See Also: NodeImpl

setTextContent

public void setTextContent(String textContent)

setUserData

public Object setUserData(String key, Object data, UserDataHandler handler)
Copyright B) 1999-2005 Apache XML Project. All Rights Reserved.