public final class DOMImplementationRegistry extends Object
DOMImplementation
.
Example:
// get an instance of the DOMImplementation registry DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance(); // get a DOM implementation the Level 3 XML module DOMImplementation domImpl = registry.getDOMImplementation("XML 3.0");
This provides an application with an implementation-independent starting point. DOM implementations may modify this class to meet new security standards or to provide *additional* fallbacks for the list of DOMImplementationSources.
DOMImplementation
,
DOMImplementationSource
Modifier and Type | Field and Description |
---|---|
static String |
PROPERTY
The system property to specify the
DOMImplementationSource class names.
|
Modifier and Type | Method and Description |
---|---|
void |
addSource(DOMImplementationSource s)
Register an implementation.
|
DOMImplementation |
getDOMImplementation(String features)
Return the first implementation that has the desired
features, or
null if none is found. |
DOMImplementationList |
getDOMImplementationList(String features)
Return a list of implementations that support the
desired features.
|
static DOMImplementationRegistry |
newInstance()
Obtain a new instance of a
DOMImplementationRegistry . |
public static final String PROPERTY
public static DOMImplementationRegistry newInstance() throws ClassNotFoundException, InstantiationException, IllegalAccessException, ClassCastException
DOMImplementationRegistry
.
The DOMImplementationRegistry
is initialized by the
application or the implementation, depending on the context, by
first checking the value of the Java system property
org.w3c.dom.DOMImplementationSourceList
and
the service provider whose contents are at
"META_INF/services/org.w3c.dom.DOMImplementationSourceList
".
The value of this property is a white-space separated list of
names of availables classes implementing the
DOMImplementationSource
interface. Each class listed
in the class name list is instantiated and any exceptions
encountered are thrown to the application.ClassNotFoundException
- If any specified class can not be foundInstantiationException
- If any specified class is an interface or abstract classIllegalAccessException
- If the default constructor of a specified class is not accessibleClassCastException
- If any specified class does not implement
DOMImplementationSource
public DOMImplementation getDOMImplementation(String features)
null
if none is found.features
- A string that specifies which features are required. This is
a space separated list in which each feature is specified by
its name optionally followed by a space and a version number.
This is something like: "XML 1.0 Traversal +Events 2.0"null
if none found.public DOMImplementationList getDOMImplementationList(String features)
features
- A string that specifies which features are required. This is
a space separated list in which each feature is specified by
its name optionally followed by a space and a version number.
This is something like: "XML 1.0 Traversal +Events 2.0"public void addSource(DOMImplementationSource s)
s
- The source to be registered, may not be null
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2022, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.