Top Description Inners Fields Constructors Methods
com.sun.org.apache.xerces.internal.dom

public Class CoreDOMImplementationImpl

extends Object
implements DOMImplementation, DOMImplementationLS
Class Inheritance
All Implemented Interfaces
org.w3c.dom.ls.DOMImplementationLS, org.w3c.dom.DOMImplementation
Known Direct Subclasses
com.sun.org.apache.xerces.internal.dom.DOMImplementationImpl, com.sun.org.apache.xerces.internal.impl.xs.XSImplementationImpl
Annotations
@SuppressWarnings:rawtypes, unchecked
Imports
com.sun.org.apache.xerces.internal.impl.RevalidationHandler, com.sun.org.apache.xerces.internal.impl.dtd.XML11DTDProcessor, .XML11DTDValidator, .XMLDTDLoader, .XMLDTDValidator, com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator, com.sun.org.apache.xerces.internal.parsers.DOMParserImpl, .DTDConfiguration, .XIncludeAwareParserConfiguration, .XML11DTDConfiguration, com.sun.org.apache.xerces.internal.util.XMLChar, com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarDescription, java.lang.ref.SoftReference, org.w3c.dom.DOMException, .DOMImplementation, .Document, .DocumentType, .Element, org.w3c.dom.ls.LSParser, .DOMImplementationLS, .LSInput, .LSOutput, .LSSerializer

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.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
CoreDOMImplementationImpl.RevalidationHandlerHolder

A holder for RevalidationHandlers.

pack-priv static class

Field Summary

Modifier and TypeField and Description
private int
private int
private int
private int
private int
private int
private SoftReference<T>[]
private int
pack-priv static final CoreDOMImplementationImpl
singleton

Dom implementation singleton.

private static final int
private int
private SoftReference<T>[]
private SoftReference<T>[]
private int
private int
private SoftReference<T>[]
private SoftReference<T>[]
private int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected synchronized int
assignDocTypeNumber()

NON-DOM: increment document/doctype counter

protected synchronized int
assignDocumentNumber()

NON-DOM: increment document/doctype counter

pack-priv final void
public Document

Returns:

Document A new Document object.
createDocument
(String
The namespace URI of the document element to create, or null.
namespaceURI
,
String
The qualified name of the document element to create.
qualifiedName
,
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.

doctype
)

Implements org.w3c.dom.DOMImplementation.createDocument.

Introduced in DOM Level 2.

protected CoreDocumentImpl
public DocumentType
createDocumentType(String
The qualified name of the document type to be created.
qualifiedName
,
String
The document type public identifier.
publicID
,
String
The document type system identifier.
systemID
)

Implements org.w3c.dom.DOMImplementation.createDocumentType.

Introduced in DOM Level 2.

public LSInput

Returns:

The newly created input object.
createLSInput
()

Implements org.w3c.dom.ls.DOMImplementationLS.createLSInput.

DOM Level 3 LS CR - Experimental.

public LSOutput
createLSOutput()

Implements org.w3c.dom.ls.DOMImplementationLS.createLSOutput.

Create a new empty output destination object where LSOutput.characterStream, LSOutput.byteStream, LSOutput.systemId, LSOutput.encoding are null.

public LSParser

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.

createLSParser
(short
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.
mode
,
String
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.

schemaType
)

Implements org.w3c.dom.ls.DOMImplementationLS.createLSParser.

DOM Level 3 LS CR - Experimental.

public LSSerializer

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.

createLSSerializer
()

Implements org.w3c.dom.ls.DOMImplementationLS.createLSSerializer.

DOM Level 3 LS CR - Experimental.

public static DOMImplementation
getDOMImplementation()

NON-DOM: Obtain and return the single shared object

pack-priv final synchronized XMLDTDLoader
getDTDLoader(String xmlVersion)

NON-DOM: retrieve DTD loader

public Object
getFeature(String
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.
feature
,
String
This is the version number of the feature to test.
version
)

Implements org.w3c.dom.DOMImplementation.getFeature.

DOM Level 3 WD - Experimental.

pack-priv synchronized RevalidationHandler
getValidator(String schemaType, String xmlVersion)

NON-DOM: retrieve validator.

public boolean

Returns:

true if this implementation is compatible with the specified feature and version.
hasFeature
(String
The package name of the feature to test. In Level 1, supported values are "HTML" and "XML" (case-insensitive). At this writing, com.sun.org.apache.xerces.internal.dom supports only XML.
feature
,
String
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"
version
)

Implements org.w3c.dom.DOMImplementation.hasFeature.

Test if the DOM implementation supports a specific "feature" -- currently meaning language and level thereof.

pack-priv final synchronized void
releaseDTDLoader(String xmlVersion, XMLDTDLoader loader)

NON-DOM: release DTD loader

pack-priv synchronized void
releaseValidator(String schemaType, String xmlVersion, RevalidationHandler validator)

NON-DOM: release validator

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

docAndDoctypeCounterback to summary
private int docAndDoctypeCounter
freeSchemaValidatorIndexback to summary
private int freeSchemaValidatorIndex
freeXML10DTDLoaderIndexback to summary
private int freeXML10DTDLoaderIndex
freeXML10DTDValidatorIndexback to summary
private int freeXML10DTDValidatorIndex
freeXML11DTDLoaderIndexback to summary
private int freeXML11DTDLoaderIndex
freeXML11DTDValidatorIndexback to summary
private int freeXML11DTDValidatorIndex
schemaValidatorsback to summary
private SoftReference<T>[] schemaValidators
schemaValidatorsCurrentSizeback to summary
private int schemaValidatorsCurrentSize
singletonback to summary
pack-priv static final CoreDOMImplementationImpl singleton

Dom implementation singleton.

SIZEback to summary
private static final int SIZE
xml10DTDLoaderCurrentSizeback to summary
private int xml10DTDLoaderCurrentSize
xml10DTDLoadersback to summary
private SoftReference<T>[] xml10DTDLoaders
xml10DTDValidatorsback to summary
private SoftReference<T>[] xml10DTDValidators
xml10DTDValidatorsCurrentSizeback to summary
private int xml10DTDValidatorsCurrentSize
xml11DTDLoaderCurrentSizeback to summary
private int xml11DTDLoaderCurrentSize
xml11DTDLoadersback to summary
private SoftReference<T>[] xml11DTDLoaders
xml11DTDValidatorsback to summary
private SoftReference<T>[] xml11DTDValidators
xml11DTDValidatorsCurrentSizeback to summary
private int xml11DTDValidatorsCurrentSize

Constructor Detail

CoreDOMImplementationImplback to summary
public CoreDOMImplementationImpl()

Method Detail

assignDocTypeNumberback to summary
protected synchronized int assignDocTypeNumber()

NON-DOM: increment document/doctype counter

assignDocumentNumberback to summary
protected synchronized int assignDocumentNumber()

NON-DOM: increment document/doctype counter

checkQNameback to summary
pack-priv final void checkQName(String qname)
createDocumentback to summary
public Document createDocument(String namespaceURI, String qualifiedName, DocumentType doctype) throws DOMException

Implements org.w3c.dom.DOMImplementation.createDocument.

Introduced in DOM Level 2.

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

Parameters
namespaceURI:String

The namespace URI of the document element to create, or null.

qualifiedName:String

The qualified name of the document element to create.

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

Document A new Document object.

Exceptions
DOMException:
WRONG_DOCUMENT_ERR: Raised if doctype has already been used with a different document.
Since
WD-DOM-Level-2-19990923
createDocumentback to summary
protected CoreDocumentImpl createDocument(DocumentType doctype)
createDocumentTypeback to summary
public DocumentType createDocumentType(String qualifiedName, String publicID, String systemID)

Implements org.w3c.dom.DOMImplementation.createDocumentType.

Introduced in DOM Level 2.

Creates an empty DocumentType node.

Parameters
qualifiedName:String

The qualified name of the document type to be created.

publicID:String

The document type public identifier.

systemID:String

The document type system identifier.

Returns:DocumentType

Doc from org.w3c.dom.DOMImplementation.createDocumentType.

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

Since
WD-DOM-Level-2-19990923
createLSInputback to summary
public LSInput createLSInput()

Implements org.w3c.dom.ls.DOMImplementationLS.createLSInput.

DOM Level 3 LS CR - Experimental. Create a new empty input source.

Returns:LSInput

The newly created input object.

createLSOutputback to summary
public LSOutput createLSOutput()

Implements org.w3c.dom.ls.DOMImplementationLS.createLSOutput.

Doc from org.w3c.dom.ls.DOMImplementationLS.createLSOutput.

Create a new empty output destination object where LSOutput.characterStream, LSOutput.byteStream, LSOutput.systemId, LSOutput.encoding are null.

Returns:LSOutput

The newly created output object.

createLSParserback to summary
public LSParser createLSParser(short mode, String schemaType) throws DOMException

Implements org.w3c.dom.ls.DOMImplementationLS.createLSParser.

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.

Parameters
mode:short

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:String

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:LSParser

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.

Exceptions
DOMException:
NOT_SUPPORTED_ERR: Raised if the requested mode or schema type is not supported.
createLSSerializerback to summary
public LSSerializer createLSSerializer()

Implements org.w3c.dom.ls.DOMImplementationLS.createLSSerializer.

DOM Level 3 LS CR - Experimental. Create a new LSSerializer object.

Returns:LSSerializer

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.

getDOMImplementationback to summary
public static DOMImplementation getDOMImplementation()

NON-DOM: Obtain and return the single shared object

getDTDLoaderback to summary
pack-priv final synchronized XMLDTDLoader getDTDLoader(String xmlVersion)

NON-DOM: retrieve DTD loader

getFeatureback to summary
public Object getFeature(String feature, String version)

Implements org.w3c.dom.DOMImplementation.getFeature.

DOM Level 3 WD - Experimental.

Parameters
feature:String

Doc from org.w3c.dom.DOMImplementation.getFeature.

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:String

Doc from org.w3c.dom.DOMImplementation.getFeature.

This is the version number of the feature to test.

Returns:Object

Doc from org.w3c.dom.DOMImplementation.getFeature.

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.

getValidatorback to summary
pack-priv synchronized RevalidationHandler getValidator(String schemaType, String xmlVersion)

NON-DOM: retrieve validator.

hasFeatureback to summary
public boolean hasFeature(String feature, String version)

Implements org.w3c.dom.DOMImplementation.hasFeature.

Test if the DOM implementation supports a specific "feature" -- currently meaning language and level thereof.

Parameters
feature:String

The package name of the feature to test. In Level 1, supported values are "HTML" and "XML" (case-insensitive). At this writing, com.sun.org.apache.xerces.internal.dom supports only XML.

version:String

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:boolean

true if this implementation is compatible with the specified feature and version.

releaseDTDLoaderback to summary
pack-priv final synchronized void releaseDTDLoader(String xmlVersion, XMLDTDLoader loader)

NON-DOM: release DTD loader

releaseValidatorback to summary
pack-priv synchronized void releaseValidator(String schemaType, String xmlVersion, RevalidationHandler validator)

NON-DOM: release validator

com.sun.org.apache.xerces.internal.dom back to summary

pack-priv final Class CoreDOMImplementationImpl.RevalidationHandlerHolder

extends Object
Class Inheritance
  • java.lang.Object
  • com.sun.org.apache.xerces.internal.dom.CoreDOMImplementationImpl.RevalidationHandlerHolder

A holder for RevalidationHandlers. This allows us to reuse SoftReferences which haven't yet been cleared by the garbage collector.

Field Summary

Modifier and TypeField and Description
pack-priv RevalidationHandler

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

handlerback to summary
pack-priv RevalidationHandler handler

Constructor Detail

RevalidationHandlerHolderback to summary
pack-priv RevalidationHandlerHolder(RevalidationHandler handler)
com.sun.org.apache.xerces.internal.dom back to summary

pack-priv final Class CoreDOMImplementationImpl.XMLDTDLoaderHolder

extends Object
Class Inheritance
  • java.lang.Object
  • com.sun.org.apache.xerces.internal.dom.CoreDOMImplementationImpl.XMLDTDLoaderHolder

A holder for XMLDTDLoaders. This allows us to reuse SoftReferences which haven't yet been cleared by the garbage collector.

Field Summary

Modifier and TypeField and Description
pack-priv XMLDTDLoader

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

loaderback to summary
pack-priv XMLDTDLoader loader

Constructor Detail

XMLDTDLoaderHolderback to summary
pack-priv XMLDTDLoaderHolder(XMLDTDLoader loader)