Java in a Nutshell, 5th Edition [Electronic resources]

نسخه متنی -صفحه : 1191/ 1103
نمايش فراداده

DocumentTypeorg.w3c.dom

Java 1.4

This interface represents the Document Type Declaration, or DTD of a document. Because the DTD is not part of the document itself, a DocumentType object is not part of DOM document tree, even though it extends the Node interface. If a Document has a DTD, then you may obtain the DocumentType object that represents it by calling the getdoctype( ) method of the Document object.

getName( ), getPublicId( ), getSystemId( ), and getInternalSubset( ) all return strings (or null) that contain the name, public identifier, system identifier, and internal subset of the document type. getEntities( ) returns a read-only NamedNodeMap that represents the a name-to-value mapping for all internal and external general entities declared by the DTD. You can use this NamedNodeMap to lookup an Entity object by name. Similarly, getNotations( ) returns a read-only NamedNodeMap that allows you to look up a Notation object declared in the DTD by name.

DocumentType does not provide access to the bulk of a DTD, which usually consists of element and attribute delcarations. Future versions of the DOM API may provide more details.

Figure 21-7. org.w3c.dom.DocumentType

public interface

DocumentType extends Node { // Public Instance Methods NamedNodeMap

getEntities ( ); String

getInternalSubset ( ); String

getName ( ); NamedNodeMap

getNotations ( ); String

getPublicId ( ); String

getSystemId ( ); }

Passed To

DOMImplementation.createDocument( )

Returned By

Document.getDoctype( ), DOMImplementation.createDocumentType( )