org.apache.xerces.dom
Class CoreDOMImplementationImpl

java.lang.Object
  extended by org.apache.xerces.dom.CoreDOMImplementationImpl
All Implemented Interfaces:
DOMImplementation, DOMImplementationLS
Direct Known Subclasses:
DOMImplementationImpl, PSVIDOMImplementationImpl, XSImplementationImpl

public class CoreDOMImplementationImpl
extends java.lang.Object
implements DOMImplementation, DOMImplementationLS

The DOMImplementation class is description of a particular implementation of the Document Object Model. As such its data is static, shared by all instances of this implementation.

The DOM API requires that it be a real object rather than static methods. However, there's nothing that says it can't be a singleton, so that's how I've implemented it.

This particular class, along with CoreDocumentImpl, supports the DOM Core and Load/Save (Experimental). Optional modules are supported by the more complete DOMImplementation class along with DocumentImpl.

Since:
PR-DOM-Level-1-19980818.
Version:
$Id: CoreDOMImplementationImpl.java 571293 2007-08-30 20:16:22Z mrglavas $

Field Summary
 
Fields inherited from interface org.w3c.dom.ls.DOMImplementationLS
MODE_ASYNCHRONOUS, MODE_SYNCHRONOUS
 
Constructor Summary
CoreDOMImplementationImpl()
           
 
Method Summary
 Document createDocument(java.lang.String namespaceURI, java.lang.String qualifiedName, DocumentType doctype)
          Introduced in DOM Level 2.
 DocumentType createDocumentType(java.lang.String qualifiedName, java.lang.String publicID, java.lang.String systemID)
          Introduced in DOM Level 2.
 LSInput createLSInput()
          DOM Level 3 LS CR - Experimental.
 LSOutput createLSOutput()
          DOM Level 3 LS CR - Experimental.
 LSParser createLSParser(short mode, java.lang.String schemaType)
          DOM Level 3 LS CR - Experimental.
 LSSerializer createLSSerializer()
          DOM Level 3 LS CR - Experimental.
static DOMImplementation getDOMImplementation()
          NON-DOM: Obtain and return the single shared object
 java.lang.Object getFeature(java.lang.String feature, java.lang.String version)
          DOM Level 3 WD - Experimental.
 boolean hasFeature(java.lang.String feature, java.lang.String version)
          Test if the DOM implementation supports a specific "feature" -- currently meaning language and level thereof.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CoreDOMImplementationImpl

public CoreDOMImplementationImpl()
Method Detail

getDOMImplementation

public static DOMImplementation getDOMImplementation()
NON-DOM: Obtain and return the single shared object


hasFeature

public boolean hasFeature(java.lang.String feature,
                          java.lang.String version)
Test if the DOM implementation supports a specific "feature" -- currently meaning language and level thereof.

Specified by:
hasFeature in interface DOMImplementation
Parameters:
feature - The package name of the feature to test. In Level 1, supported values are "HTML" and "XML" (case-insensitive). At this writing, org.apache.xerces.dom supports only XML.
version - The version number of the feature being tested. This is interpreted as "Version of the DOM API supported for the specified Feature", and in Level 1 should be "1.0"
Returns:
true iff this implementation is compatible with the specified feature and version.

createDocumentType

public DocumentType createDocumentType(java.lang.String qualifiedName,
                                       java.lang.String publicID,
                                       java.lang.String systemID)
Introduced in DOM Level 2.

Creates an empty DocumentType node.

Specified by:
createDocumentType in interface DOMImplementation
Parameters:
qualifiedName - The qualified name of the document type to be created.
publicID - The document type public identifier.
systemID - The document type system identifier.
Returns:
A new DocumentType node with Node.ownerDocument set to null.
Since:
WD-DOM-Level-2-19990923

createDocument

public Document createDocument(java.lang.String namespaceURI,
                               java.lang.String qualifiedName,
                               DocumentType doctype)
                        throws DOMException
Introduced in DOM Level 2.

Creates an XML Document object of the specified type with its document element.

Specified by:
createDocument in interface DOMImplementation
Parameters:
namespaceURI - The namespace URI of the document element to create, or null.
qualifiedName - The qualified name of the document element to create.
doctype - 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.
Throws:
DOMException - WRONG_DOCUMENT_ERR: Raised if doctype has already been used with a different document.
Since:
WD-DOM-Level-2-19990923

getFeature

public java.lang.Object getFeature(java.lang.String feature,
                                   java.lang.String version)
DOM Level 3 WD - Experimental.

Specified by:
getFeature in interface DOMImplementation
Parameters:
feature - 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 - This is the version number of the feature to test.
Returns:
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.

createLSParser

public LSParser createLSParser(short mode,
                               java.lang.String schemaType)
                        throws DOMException
DOM Level 3 LS CR - Experimental. Create a new LSParser. The newly constructed parser may then be configured by means of its DOMConfiguration object, and used to parse documents by means of its parse method.

Specified by:
createLSParser in interface DOMImplementationLS
Parameters:
mode - The mode argument is either MODE_SYNCHRONOUS or MODE_ASYNCHRONOUS, if mode is MODE_SYNCHRONOUS then the LSParser that is created will operate in synchronous mode, if it's MODE_ASYNCHRONOUS then the LSParser that is created will operate in asynchronous mode.
schemaType - An absolute URI representing the type of the schema language used during the load of a Document using the newly created LSParser. Note that no lexical checking is done on the absolute URI. In order to create a LSParser for any kind of schema types (i.e. the LSParser will be free to use any schema found), use the value null.

Note: For W3C XML Schema [XML Schema Part 1] , applications must use the value "http://www.w3.org/2001/XMLSchema". For XML DTD [XML 1.0], applications must use the value "http://www.w3.org/TR/REC-xml". Other Schema languages are outside the scope of the W3C and therefore should recommend an absolute URI in order to use this method.

Returns:
The newly created LSParser object. This LSParser is either synchronous or asynchronous depending on the value of the mode argument.

Note: By default, the newly created LSParser does not contain a DOMErrorHandler, i.e. the value of the " error-handler" configuration parameter is null. However, implementations may provide a default error handler at creation time. In that case, the initial value of the "error-handler" configuration parameter on the new created LSParser contains a reference to the default error handler.

Throws:
DOMException - NOT_SUPPORTED_ERR: Raised if the requested mode or schema type is not supported.

createLSSerializer

public LSSerializer createLSSerializer()
DOM Level 3 LS CR - Experimental. Create a new LSSerializer object.

Specified by:
createLSSerializer in interface DOMImplementationLS
Returns:
The newly created LSSerializer object.

Note: By default, the newly created LSSerializer has no DOMErrorHandler, i.e. the value of the "error-handler" configuration parameter is null. However, implementations may provide a default error handler at creation time. In that case, the initial value of the "error-handler" configuration parameter on the new created LSSerializer contains a reference to the default error handler.


createLSInput

public LSInput createLSInput()
DOM Level 3 LS CR - Experimental. Create a new empty input source.

Specified by:
createLSInput in interface DOMImplementationLS
Returns:
The newly created input object.

createLSOutput

public LSOutput createLSOutput()
DOM Level 3 LS CR - Experimental. Create a new empty output destination object where LSOutput.characterStream, LSOutput.byteStream, LSOutput.systemId, LSOutput.encoding are null.

Specified by:
createLSOutput in interface DOMImplementationLS
Returns:
The newly created output object.