Packagedom.core
Interfacepublic interface DOMImplementation

Introduced in: DOM 1 Core 
Modified in: DOM 3 Core 

The DOMImplementation interface provides a number of methods for performing operations that are independent of any particular instance of the document object model.

See also

MSDN - DOMImplementation Prototype
MDC - DOMImplementation
W3C - DOMImplementation


Public Methods
 MethodDefined By
  
DOM 2 Core createDocument(namespaceURI:DOMString, qualifiedName:DOMString, doctype:DocumentType):Document
This method creates a DOM document.
DOMImplementation
  
DOM 2 Core createDocumentType(qualifiedName:DOMString, publicId:DOMString, systemId:DOMString):DocumentType
Creates an empty DocumentType node.
DOMImplementation
  
DOM 3 Core getFeature(feature:DOMString, version:DOMString):DOMObject
This method returns a specialized object which implements the specialized APIs of the specified feature and version, as specified in DOM Features.
DOMImplementation
  
DOM 1 Core hasFeature(feature:DOMString, version:DOMString):Boolean
Test if the DOM implementation implements a specific feature and version, as specified in DOM Features.
DOMImplementation
Method Detail
DOM 2 Core createDocument()method
public function createDocument(namespaceURI:DOMString, qualifiedName:DOMString, doctype:DocumentType):Document

Introduced in: DOM 2 Core 

This method creates a DOM document.

Parameters

namespaceURI:DOMString — The namespace URI of the document element to create or null.
 
qualifiedName:DOMString — The qualified name of the document element to be created or null.
 
doctype:DocumentType — The type of document to be created or null. When doctype is not null, its Node.ownerDocument attribute is set to the document being created.

Returns
Document — A new Document object with its document element. If the NamespaceURI, qualifiedName, and doctype are null, the returned Document is empty with no document element.

Throws
DOMException — INVALID_CHARACTER_ERR: Raised if the specified qualified name is not an XML name according to [XML 1.0].
 
DOMException — NAMESPACE_ERR: Raised if the qualifiedName is malformed, if the qualifiedName has a prefix and the namespaceURI is null, or if the qualifiedName is null and the namespaceURI is different from null, or if the qualifiedName has a prefix that is "xml" and the namespaceURI is different from "http://www.w3.org/XML/1998/namespace" [XML Namespaces], or if the DOM implementation does not support the "XML" feature but a non-null namespace URI was provided, since namespaces were defined by XML.
 
DOMException — WRONG_DOCUMENT_ERR: Raised if doctype has already been used with a different document or was created from a different implementation.
 
DOMException — NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces.

See also


Example
         var doc = document.implementation.createDocument ('http://www.w3.org/1999/xhtml', 'html', null);
         var body = document.createElementNS('http://www.w3.org/1999/xhtml', 'body');
         body.setAttribute('id', 'abc');
         doc.documentElement.appendChild(body);
         alert(doc.getElementById('abc')); // [object HTMLBodyElement]
DOM 2 Core createDocumentType()method 
public function createDocumentType(qualifiedName:DOMString, publicId:DOMString, systemId:DOMString):DocumentType

Introduced in: DOM 2 Core 

Creates an empty DocumentType node.

Entity declarations and notations are not made available. Entity reference expansions and default attribute additions do not occur.

Parameters

qualifiedName:DOMString — The qualified name of the document type to be created.
 
publicId:DOMString — The external subset public identifier.
 
systemId:DOMString — The external subset system identifier.

Returns
DocumentType — A new DocumentType node with Node.ownerDocument set to null.

Throws
DOMException — INVALID_CHARACTER_ERR: Raised if the specified qualified name is not an XML name according to [XML 1.0].
 
DOMException — NAMESPACE_ERR: Raised if the qualifiedName is malformed.
 
DOMException — NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces.

See also


Example
         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);
         alert(d.doctype.publicId); // -//W3C//DTD SVG 1.1//EN
DOM 3 Core getFeature()method 
public function getFeature(feature:DOMString, version:DOMString):DOMObject

Introduced in: DOM 3 Core 

This method returns a specialized object which implements the specialized APIs of the specified feature and version, as specified in DOM Features.

The specialized object may also be obtained by using binding-specific casting methods but is not necessarily expected to, as discussed in Mixed DOM Implementations. This method also allow the implementation to provide specialized objects which do not support the DOMImplementation interface.

Parameters

feature:DOMString — The name of the feature requested. Note that any plus sign "+" prepended to the name of the feature will be ignored since it is not significant in the context of this method.
 
version:DOMString — This is the version number of the feature to test.

Returns
DOMObject — Returns an object which implements the specialized APIs of the specified feature and version, if any, or null if there is no object which implements interfaces associated with that feature. If the DOMObject returned by this method implements the DOMImplementation interface, it must delegate to the primary core DOMImplementation and not return results inconsistent with the primary core DOMImplementation such as hasFeature, getFeature, etc.

See also


Example
         if (myNode.isSupported("+Events", "3.0")) {
             // (the plus sign "+" is irrelevant for the getFeature method itself and is ignored by this method anyway)
             EventTarget evt = (EventTarget) myNode.getFeature("Events", "3.0");
             // ...
         }
DOM 1 Core hasFeature()method 
public function hasFeature(feature:DOMString, version:DOMString):Boolean

Introduced in: DOM 1 Core 

Test if the DOM implementation implements a specific feature and version, as specified in DOM Features.

Parameters

feature:DOMString — The name of the feature to test.
 
version:DOMString — This is the version number of the feature to test.

Returns
Boolean — If the feature is implemented in the specified version.

See also


Example
The following example uses the hasFeature method to test whether the object implements the DOM HTML standard.
var bSupported = document.implementation.hasFeature("HTML","1.0");