|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gnu.xml.dom.DomNode | +--gnu.xml.dom.DomExtern | +--gnu.xml.dom.DomDoctype
"DocumentType" implementation (with no extensions for supporting any document typing information). This is a non-core DOM class, supporting the "XML" feature.
Few XML applications will actually care about this partial DTD support, since it doesn't expose any (!) of the data typing facilities which can motivate applications to use DTDs. It does not expose element content models, or information about attribute typing rules. Plus the information it exposes isn't very useful; as one example, DOM exposes information about unparsed ENTITY objects, which is only used with certain element attributes, but does not expose the information about those attributes which is needed to apply that data!
Also, note that there are no nonportable ways to associate even the notation and entity information exposed by DOM with a DocumentType. While there is a DOM L2 method to construct a DocumentType, it only gives access to the textual content of the <!DOCTYPE ...> declaration.
In short, you are strongly advised not to rely on this incomplete DTD functionality in your application code.
DomEntity
,
DomEntityReference
,
DomNotation
Fields inherited from interface org.w3c.dom.Node |
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE |
Constructor Summary | |
protected |
DomDoctype(DOMImplementation impl,
java.lang.String name,
java.lang.String publicId,
java.lang.String systemId,
java.lang.String internalSubset)
Constructs a DocumentType node associated with the specified implementation, with the specified name. |
Method Summary | |
Entity |
declareEntity(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId,
java.lang.String notation)
Records the declaration of a general entity in this DocumentType. |
Notation |
declareNotation(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
Records the declaration of a notation in this DocumentType. |
NamedNodeMap |
getEntities()
DOM L1 Returns information about any general entities declared in the DTD. |
DOMImplementation |
getImplementation()
Returns the implementation associated with this document type. |
java.lang.String |
getInternalSubset()
DOM L2 Returns the internal subset of the document, as a string of unparsed XML declarations (and comments, PIs, whitespace); or returns null if there is no such subset. |
java.lang.String |
getName()
DOM L1 Returns the root element's name (just like getNodeName). |
NamedNodeMap |
getNotations()
DOM L1 Returns information about any notations declared in the DTD. |
void |
makeReadonly()
Sets the internal "readonly" flag so the node and its associated data (only lists of entities and notations, no type information at the moment) can't be changed. |
boolean |
supports(java.lang.String feature,
java.lang.String version)
DOM L2 Consults the DOM implementation to determine if the requested feature is supported. |
Methods inherited from class gnu.xml.dom.DomExtern |
getNodeName, getPublicId, getSystemId |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.w3c.dom.DocumentType |
getPublicId, getSystemId |
Methods inherited from interface org.w3c.dom.Node |
appendChild, cloneNode, getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, removeChild, replaceChild, setNodeValue, setPrefix |
Constructor Detail |
protected DomDoctype(DOMImplementation impl, java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String internalSubset)
This constructor should only be invoked by a DOMImplementation as part of its createDocumentType functionality, or through a subclass which is similarly used in a "Sub-DOM" style layer.
Note that at this time there is no standard SAX API granting access to the internal subset text, so that relying on that value is not currently portable.
impl
- The implementation with which this object is associatedname
- Name of this root elementpublicId
- If non-null, provides the external subset's
PUBLIC identifiersystemId
- If non-null, provides the external subset's
SYSTEM identifierinternalSubset
- Provides the literal value (unparsed, no
entities expanded) of the DTD's internal subset.Method Detail |
public final java.lang.String getName()
getName
in interface DocumentType
public NamedNodeMap getEntities()
Note: DOM L1 doesn't throw a DOMException here, but then it doesn't have the strange construction rules of L2.
getEntities
in interface DocumentType
DOMException
- HIERARCHY_REQUEST_ERR if the DocumentType
is not associated with a document.public Entity declareEntity(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notation)
name
- Name of the entitypublicId
- If non-null, provides the entity's PUBLIC identifiersystemId
- Provides the entity's SYSTEM identifiernotation
- If non-null, provides the entity's notation
(indicating an unparsed entity)DOMException
- NO_MODIFICATION_ALLOWED_ERR if the
DocumentType is no longer writable.DOMException
- HIERARCHY_REQUEST_ERR if the DocumentType
is not associated with a document.public NamedNodeMap getNotations()
Note: DOM L1 doesn't throw a DOMException here, but then it doesn't have the strange construction rules of L2.
getNotations
in interface DocumentType
DOMException
- HIERARCHY_REQUEST_ERR if the DocumentType
is not associated with a document.public Notation declareNotation(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
name
- Name of the notationpublicId
- If non-null, provides the notation's PUBLIC identifiersystemId
- If non-null, provides the notation's SYSTEM identifierDOMException
- NO_MODIFICATION_ALLOWED_ERR if the
DocumentType is no longer writable.DOMException
- HIERARCHY_REQUEST_ERR if the DocumentType
is not associated with a document.public java.lang.String getInternalSubset()
Some application-specific XML profiles require that documents only use specific PUBLIC identifiers, without an internal subset to modify the interperetation of the declarations associated with that PUBLIC identifier through some standard.
getInternalSubset
in interface DocumentType
public void makeReadonly()
makeReadonly
in class DomNode
public final boolean supports(java.lang.String feature, java.lang.String version)
public final DOMImplementation getImplementation()
|
Source code is GPL'd in the JAXP subproject at http://savannah.gnu.org/projects/classpathx |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |