DOM implementation extensions

The DOMImplementation interface continues to hold the original method for checking for the presence of features supported by the parser:

					boolean hasFeature( String feature, String version);
				

But the createDocumentType and createDocument methods have been added, allowing new document types and individual documents to be created from scratch within the DOM:

Document     createDocument(String namespaceURI,
                            String qualifiedName,
                            DocumentType doctype);
DocumentType createDocumentType(String qualifiedName,
                                String publicId,
                                String systemId);

For example, the Xerces parser implements this interface in a class called DOMImplementationImpl:

 import org.apache.xerces.dom.DOMImplementationImpl; ... DOMImplementationImpl myDOMImpl ...

Get XML Companion, The, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.