This object allows for "meta-operations" - i.e. those outside the scope of a particular document instance.
The standard does not define how the implementation provides this object. The following should be portable but does not support access to multiple implementations:
var DOMImplementation = document.implementation;
See Document Object Model for a list of the features that can be tested. version should be "2.0" for the current version or "1.0" to test for DOM1 compliance. The method will return "true" if the feature is supported by the implementation at the given version.
Creates a DocumentType object for a particular DTD. qualifiedName, publicId and systemId refer to the parameters to the !DOCTYPE directive. For example,
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "/usr/lib/DTDs/docbkx412/DOCBOOKX.DTD">
var DOMImplementation = document.implementation; var bookType = DOMImplementation.createDocumentType("book", "-//OASIS//DTD DocBook XML V4.1.2//EN", "/usr/lib/DTDs/docbkx412/DOCBOOKX.DTD");
Also note there's no way of creating <!ENTITY> references (that is, you can't script something like this:
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "/usr/lib/DTDs/docbkx412/DOCBOOKX.DTD"[ <!ENTITY chp1 "chp1.xml"> ]>
The exceptions thrown are:
This creates a new Document object of the given doctype. The namespaceURI should be the reference for the namespace prefix for the qualifiedName; it can be null if no namespace prefix is supplied on qualifiedName. Note that doctype is made a child of the Document object created.
A brief code sample:
var DOMImplementation = document.implementation; var bookType = DOMImplementation.createDocumentType("book", "-//OASIS//DTD DocBook XML V4.1.2//EN", "/usr/lib/DTDs/docbkx412/DOCBOOKX.DTD"); var doc = DOMImplementation.createDocument(null, "book", bookType);
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "/usr/lib/DTDs/docbkx412/DOCBOOKX.DTD"> <book/>
Log in or register to write something here or to contact authors.