- XML DOM Basics
- XML DOM - Home
- XML DOM - Overview
- XML DOM - Model
- XML DOM - Nodes
- XML DOM - Node Tree
- XML DOM - Methods
- XML DOM - Loading
- XML DOM - Traversing
- XML DOM - Navigation
- XML DOM - Accessing
- XML DOM Operations
- XML DOM - Get Node
- XML DOM - Set Node
- XML DOM - Create Node
- XML DOM - Add Node
- XML DOM - Replace Node
- XML DOM - Remove Node
- XML DOM - Clone Node
- XML DOM Objects
- DOM - Node Object
- DOM - NodeList Object
- DOM - NamedNodeMap Object
- DOM - DOMImplementation
- DOM - DocumentType Object
- DOM - ProcessingInstruction
- DOM - Entity Object
- DOM - EntityReference Object
- DOM - Notation Object
- DOM - Element Object
- DOM - Attribute Object
- DOM - CDATASection Object
- DOM - Comment Object
- DOM - XMLHttpRequest Object
- DOM - DOMException Object
- XML DOM Useful Resources
- XML DOM - Quick Guide
- XML DOM - Useful Resources
- XML DOM - Discussion
DOM - DOMImplementation Object Method - createdocument
The method createDocumentType () is used to create an empty DocumentType node. Entity declarations and notations are not made available.
Syntax
Following is the syntax of the createDocument () method.
Document doc = document.implementation.createDocumentType(qualifiedName, publicId, systemId);
qualifiedName is the qualified name of the document type to be created.
publicId is the external subset public identifier.
systemId external subset system identifier.
This method returns a new DocumentType node with Node.ownerDocument set to null.
Example
Following example demonstrates the usage of the createDocumentType () method −
<!DOCTYPE html> <html> <body> <script> var dt = document.implementation.createDocumentType('svg:svg', '-//W3C//DTD SVG 1.1//EN', 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'); var d = document.implementation.createDocument('http://www.w3.org/2000/svg', 'svg:svg', dt); document.write(d.doctype.publicId); // -//W3C//DTD SVG 1.1//EN </script> </body> </html>
Execution
Save this file as domimplementation_createdocumenttype.htm on the server path (this file and node.xml should be on the same path in your server). We will get the output as shown below −
-//W3C//DTD SVG 1.1//EN
dom_domimplementation_object.htm
Advertisements