Name
createDocument: namespaceURI, qualifiedName,
doctype(2)
Synopsis
Creates a new, empty Document
object with the given document
type. It also creates the single, top-level document element using
the given qualified name and namespace URI.
Arguments
- namespaceURI: DOMString
The namespace URI used to create the top-level document element. Can be
null
if no namespace is used.- qualifiedName: DOMString
The namespace-aware qualified name of the top-level document element to be created. The prefix given in this parameter is associated with the namespace URI given in the
namespaceURI
parameter.- doctype: DOMString
The document type definition object to be associated with the new document. If this parameter is not
null
, theDocumentType
node’sownerDocument
attribute is set to point to the new document object.
Exceptions
- INVALID_CHARACTER_ERR
Indicates that the
qualifiedName
parameter has a malformed XML identifier.- NAMESPACE_ERR
Raised if an inconsistency exists between the values given for the
namespaceURI
and thequalifiedName
parameters. Passing in a qualified name with a namespace prefix and not passing in a namespace URI is illegal. This can also be generated if a reserved namespace prefix, such asxml
, is given with an incorrect namespace URI.- WRONG_DOCUMENT_ERR
Raised if the
DocumentType
node passed in thedoctype
parameter is already associated with another document object. NewDocumentType
objects must be created using the newcreateDocumentType
method of theDOMImplementation
interface.
Java ...
Get XML in a Nutshell, 3rd 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.