Class DocumentTypeImpl
- All Implemented Interfaces:
Serializable,Cloneable,DocumentType,EventTarget,Node,NodeList
- Direct Known Subclasses:
DeferredDocumentTypeImpl
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 699892 2008-09-28 21:08:27Z mrglavas $
- Author:
- Arnaud Le Hors, IBM, Joe Kesselman, IBM, Andy Clark, IBM
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected NamedNodeMapImplElements.protected NamedNodeMapImplEntities.protected Stringprotected StringDocument type name.protected NamedNodeMapImplNotations.protected Stringprotected StringFields inherited from class org.apache.xerces.dom.ParentNode
firstChild, fNodeListCache, ownerDocumentFields inherited from class org.apache.xerces.dom.ChildNode
nextSibling, previousSiblingFields 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, flags, HASSTRING, ID, IGNORABLEWS, NORMALIZED, OWNED, ownerNode, 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_NODEFields 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
ConstructorsConstructorDescriptionDocumentTypeImpl(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
Modifier and TypeMethodDescriptioncloneNode(boolean deep) Clones the node.NON-DOM: Access the collection of ElementDefinitions.Access the collection of general Entities, both external and internal, defined in the DTD.Introduced in DOM Level 2.getName()Name of this document type.Returns the document type nameprotected intNON-DOM Get the number associated with this doctype.shortA short integer indicating what type of node this is.Access the collection of Notations defined in the DTD.Introduced in DOM Level 2.Introduced in DOM Level 2.This attribute returns the text content of this node and its descendants.getUserData(String key) Retrieves the object associated to a key on a this node.protected HashtablebooleanisEqualNode(Node arg) DOM Level 3 WD- Experimental.voidsetInternalSubset(String internalSubset) NON-DOM.protected voidNON-DOM set the ownerDocument of this node and its childrenvoidsetReadOnly(boolean readOnly, boolean deep) NON-DOM: Subclassed to flip the entities' and notations' readonly switch as well.voidsetTextContent(String textContent) This attribute returns the text content of this node and its descendants.setUserData(String key, Object data, UserDataHandler handler) Associate an object to a key on this node.Methods inherited from class org.apache.xerces.dom.ParentNode
getChildNodes, getChildNodesUnoptimized, getFirstChild, getLastChild, getLength, getOwnerDocument, hasChildNodes, insertBefore, item, normalize, removeChild, replaceChild, synchronizeChildrenMethods inherited from class org.apache.xerces.dom.ChildNode
getNextSibling, getParentNode, getPreviousSiblingMethods inherited from class org.apache.xerces.dom.NodeImpl
addEventListener, appendChild, changed, changes, compareDocumentPosition, compareTreePosition, dispatchEvent, getAttributes, getBaseURI, getContainer, getFeature, getLocalName, getNamespaceURI, getNodeValue, getPrefix, getReadOnly, getUserData, hasAttributes, isDefaultNamespace, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, needsSyncChildren, removeEventListener, setNodeValue, setPrefix, setUserData, synchronizeData, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.w3c.dom.Node
appendChild, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix
-
Field Details
-
name
Document type name. -
entities
Entities. -
notations
Notations. -
elements
Elements. -
publicID
-
systemID
-
internalSubset
-
-
Constructor Details
-
DocumentTypeImpl
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
-
getPublicId
Introduced in DOM Level 2.Return the public identifier of this Document type.
- Specified by:
getPublicIdin interfaceDocumentType- Since:
- WD-DOM-Level-2-19990923
-
getSystemId
Introduced in DOM Level 2.Return the system identifier of this Document type.
- Specified by:
getSystemIdin interfaceDocumentType- Since:
- WD-DOM-Level-2-19990923
-
setInternalSubset
NON-DOM.Set the internalSubset given as a string.
-
getInternalSubset
Introduced in DOM Level 2.Return the internalSubset given as a string.
- Specified by:
getInternalSubsetin interfaceDocumentType- 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.- Specified by:
getNodeTypein interfaceNode- Specified by:
getNodeTypein classNodeImpl
-
getNodeName
Returns the document type name- Specified by:
getNodeNamein interfaceNode- Specified by:
getNodeNamein classNodeImpl
-
cloneNode
Clones the node.- Specified by:
cloneNodein interfaceNode- Overrides:
cloneNodein classParentNode- See Also:
-
getTextContent
Description copied from class:NodeImplThis attribute returns the text content of this node and its descendants. When it is defined to be null, setting it has no effect. When set, any possible children this node may have are removed and replaced by a singleTextnode 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, the returned string does not contain the element content whitespaces . 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: /** This attribute returns the text content of this node and its descendants. When it is defined to be null, setting it has no effect. When set, any possible children this node may have are removed and replaced by a singleNode type Content Textnode 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, the returned string does not contain the element content whitespaces . 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 type Content ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, DOCUMENT_FRAGMENT_NODE concatenation of the textContentattribute value of every child node, excluding COMMENT_NODE and PROCESSING_INSTRUCTION_NODE nodesATTRIBUTE_NODE, TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE nodeValueDOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE null - Specified by:
getTextContentin interfaceNode- Overrides:
getTextContentin classParentNode- Throws:
DOMException- NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.DOMException- DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in aDOMStringvariable on the implementation platform.
setTextContent
Description copied from class:NodeImplThis attribute returns the text content of this node and its descendants. When it is defined to be null, setting it has no effect. When set, any possible children this node may have are removed and replaced by a singleTextnode 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, the returned string does not contain the element content whitespaces . 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 type Content ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, DOCUMENT_FRAGMENT_NODE concatenation of the textContentattribute value of every child node, excluding COMMENT_NODE and PROCESSING_INSTRUCTION_NODE nodesATTRIBUTE_NODE, TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE nodeValueDOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE null - Specified by:
setTextContentin interfaceNode- Overrides:
setTextContentin classParentNode- Throws:
DOMException- NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.DOMException- DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in aDOMStringvariable on the implementation platform.
isEqualNode
DOM Level 3 WD- Experimental. Override inherited behavior from ParentNodeImpl to support deep equal.- Specified by:
isEqualNodein interfaceNode- Overrides:
isEqualNodein classParentNode- Parameters:
arg- The node to compare equality with.- Returns:
- If the nodes, and possibly subtrees are equal,
trueotherwisefalse.
setOwnerDocument
NON-DOM set the ownerDocument of this node and its children- Overrides:
setOwnerDocumentin classParentNode
getNodeNumber
protected int getNodeNumber()NON-DOM Get the number associated with this doctype.- Overrides:
getNodeNumberin classNodeImpl
getName
Name of this document type. If we loaded from a DTD, this should be the name immediately following the DOCTYPE keyword.- Specified by:
getNamein interfaceDocumentType
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:
getEntitiesin interfaceDocumentType
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:
getNotationsin interfaceDocumentType
setReadOnly
public void setReadOnly(boolean readOnly, boolean deep) NON-DOM: Subclassed to flip the entities' and notations' readonly switch as well.- Overrides:
setReadOnlyin classParentNode- Parameters:
readOnly- True or false as desired.deep- If true, children are also toggled. Note that this will not change the state of an EntityReference or its children, which are always read-only.- See Also:
getElements
NON-DOM: Access the collection of ElementDefinitions.- See Also:
setUserData
Description copied from class:NodeImplAssociate an object to a key on this node. The object can later be retrieved from this node by callinggetUserDatawith the same key.- Specified by:
setUserDatain interfaceNode- Overrides:
setUserDatain classNodeImpl- Parameters:
key- The key to associate the object to.data- The object to associate to the given key, ornullto remove any existing association to that key.handler- The handler to associate to that key, ornull.- Returns:
- Returns the
DOMObjectpreviously associated to the given key on this node, ornullif there was none.
getUserData
Description copied from class:NodeImplRetrieves the object associated to a key on a this node. The object must first have been set to this node by callingsetUserDatawith the same key.- Specified by:
getUserDatain interfaceNode- Overrides:
getUserDatain classNodeImpl- Parameters:
key- The key the object is associated to.- Returns:
- Returns the
DOMObjectassociated to the given key on this node, ornullif there was none.
getUserDataRecord
- Overrides:
getUserDataRecordin classNodeImpl
-