Package org.apache.harmony.xml.dom
Class DocumentTypeImpl
- java.lang.Object
-
- org.apache.harmony.xml.dom.NodeImpl
-
- org.apache.harmony.xml.dom.LeafNodeImpl
-
- org.apache.harmony.xml.dom.DocumentTypeImpl
-
- All Implemented Interfaces:
DocumentType,Node
public final class DocumentTypeImpl extends LeafNodeImpl implements DocumentType
Provides a straightforward implementation of the corresponding W3C DOM interface. The class is used internally only, thus only notable members that are not in the original interface are documented (the W3C docs are quite extensive). Hope that's ok.Some of the fields may have package visibility, so other classes belonging to the DOM implementation can easily access them while maintaining the DOM tree structure.
-
-
Field Summary
-
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
Constructors Constructor Description DocumentTypeImpl(DocumentImpl document, String qualifiedName, String publicId, String systemId)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NamedNodeMapgetEntities()ANamedNodeMapcontaining the general entities, both external and internal, declared in the DTD.StringgetInternalSubset()The internal subset as a string, ornullif there is none.StringgetName()The name of DTD; i.e., the name immediately following theDOCTYPEkeyword.StringgetNodeName()The name of this node, depending on its type; see the table above.shortgetNodeType()A code representing the type of the underlying object, as defined above.NamedNodeMapgetNotations()ANamedNodeMapcontaining the notations declared in the DTD.StringgetPublicId()The public identifier of the external subset.StringgetSystemId()The system identifier of the external subset.StringgetTextContent()This attribute returns the text content of this node and its descendants.-
Methods inherited from class org.apache.harmony.xml.dom.LeafNodeImpl
getNextSibling, getParentNode, getPreviousSibling
-
Methods inherited from class org.apache.harmony.xml.dom.NodeImpl
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNodeValue, getOwnerDocument, getPrefix, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
-
-
-
-
Constructor Detail
-
DocumentTypeImpl
public DocumentTypeImpl(DocumentImpl document, String qualifiedName, String publicId, String systemId)
-
-
Method Detail
-
getNodeName
public String getNodeName()
Description copied from interface:NodeThe name of this node, depending on its type; see the table above.- Specified by:
getNodeNamein interfaceNode- Overrides:
getNodeNamein classNodeImpl
-
getNodeType
public short getNodeType()
Description copied from interface:NodeA code representing the type of the underlying object, as defined above.- Specified by:
getNodeTypein interfaceNode- Specified by:
getNodeTypein classNodeImpl
-
getEntities
public NamedNodeMap getEntities()
Description copied from interface:DocumentTypeANamedNodeMapcontaining the general entities, both external and internal, declared in the DTD. Parameter entities are not contained. Duplicates are discarded. For example in:<!DOCTYPE ex SYSTEM "ex.dtd" [ <!ENTITY foo "foo"> <!ENTITY bar "bar"> <!ENTITY bar "bar2"> <!ENTITY % baz "baz"> ]> <ex/>
the interface provides access tofooand the first declaration ofbarbut not the second declaration ofbarorbaz. Every node in this map also implements theEntityinterface.
The DOM Level 2 does not support editing entities, thereforeentitiescannot be altered in any way.- Specified by:
getEntitiesin interfaceDocumentType
-
getInternalSubset
public String getInternalSubset()
Description copied from interface:DocumentTypeThe internal subset as a string, ornullif there is none. This is does not contain the delimiting square brackets.Note: The actual content returned depends on how much information is available to the implementation. This may vary depending on various parameters, including the XML processor used to build the document.
- Specified by:
getInternalSubsetin interfaceDocumentType
-
getName
public String getName()
Description copied from interface:DocumentTypeThe name of DTD; i.e., the name immediately following theDOCTYPEkeyword.- Specified by:
getNamein interfaceDocumentType
-
getNotations
public NamedNodeMap getNotations()
Description copied from interface:DocumentTypeANamedNodeMapcontaining the notations declared in the DTD. Duplicates are discarded. Every node in this map also implements theNotationinterface.
The DOM Level 2 does not support editing notations, thereforenotationscannot be altered in any way.- Specified by:
getNotationsin interfaceDocumentType
-
getPublicId
public String getPublicId()
Description copied from interface:DocumentTypeThe public identifier of the external subset.- Specified by:
getPublicIdin interfaceDocumentType
-
getSystemId
public String getSystemId()
Description copied from interface:DocumentTypeThe system identifier of the external subset. This may be an absolute URI or not.- Specified by:
getSystemIdin interfaceDocumentType
-
getTextContent
public String getTextContent() throws DOMException
Description copied from interface:NodeThis attribute returns the text content of this node and its descendants. When it is defined to benull, 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 ornull, 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 and the returned string does not contain the white spaces in element content (see the attributeText.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 type Content ELEMENT_NODE, ATTRIBUTE_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 nodes. This is the empty string if the node has no children.TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE nodeValueDOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE null - Specified by:
getTextContentin interfaceNode- Overrides:
getTextContentin classNodeImpl- Throws:
DOMException- DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in aDOMStringvariable on the implementation platform.
-
-