DOM2 is divided into fourteen modules organized in eight different packages. DOM1 roughly corresponds to the Core and XML modules. The other twelve modules are new in DOM2.
Aside from the core and XML modules, not all DOM implementations support all of these modules, or all parts of the modules that they do support. Most Java implementations do support the traversal module; the events module is not uncommon; and the range module is occasionally supported. As far as I know, only Xerces supports the HTML module. So far I haven't found any parsers that support the views, StyleSheets, or CSS modules. The hasFeature() method in the DOMImplementation interface can tell you whether that implementation supports a particular feature. Just pass in the name and version of the feature you're looking for. For DOM2 the version is "2.0" . public boolean hasFeature (String name, String version ) In addition to the standard modules, implementations and application-specific DOMs may define additional feature name strings. These nonstandard features use a reversed domain name, much like a Java package name, to clearly indicate who is responsible for the feature. For example, SVG 1.0 uses the feature name "org.w3c.dom.svg" and the version number "1.0" to indicate support for some part of the SVG DOM. It uses the feature strings "org.w3c.dom.svg.static" , "org.w3c.dom.svg.animation" , or "org.w3c.dom.svg.dynamic" to indicate support for specific parts of the SVG DOM. Different DOM implementations use different concrete classes to implement the standard interfaces. For example, in Xerces, the org.apache.xerces.dom.DOMImplementationImpl singleton class implements the DOMImplementation interface. In the Oracle XML Parser for Java, XMLDOMImplementation implements the DOMImplementation interface. This class has a simple no-args constructor. Example 9.1 uses this class and constructor to check for the standard features in Oracle. Example 9.1 Which Modules Does Oracle Support?import oracle.xml.parser.v2.XMLDOMImplementation; import org.w3c.dom.DOMImplementation; public class OracleModuleChecker { public static void main(String[] args){ // parser dependent DOMImplementation implementation = new XMLDOMImplementation(); String[] features = {"Core", "XML", "HTML", "Views", "StyleSheets", "CSS", "CSS2", "Events", "UIEvents", "MouseEvents", "MutationEvents", "HTMLEvents", "Traversal", "Range"}; for (int i = 0; i < features.length; i++) { if (implementation.hasFeature(features[i], "2.0")) { System.out.println("Oracle supports " + features[i]); } else { System.out.println("Oracle does not support " + features[i]); } } } } Following is the output from Version 9.0.1.1.0A Production of the Oracle XML Parser for Java. Notice that Oracle only supports the XML, events, traversal, and range modules. The reported lack of support for core is almost certainly just an oversight. The "Core" feature string was only added in the final draft of DOM2 and was not present in earlier drafts. The core module is a prerequisite for all the other modules. It's hard to believe Oracle really doesn't support it. D:\books\XMLJAVA\examples> java OracleModuleChecker Oracle does not support Core Oracle supports XML Oracle does not support HTML Oracle does not support Views Oracle does not support StyleSheets Oracle does not support CSS Oracle does not support CSS2 Oracle supports Events Oracle does not support UIEvents Oracle does not support MouseEvents Oracle does not support MutationEvents Oracle does not support HTMLEvents Oracle supports Traversal Oracle supports Range |