Do not reference a specific DOMImplementation. Use instead:
DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance(); DOMImplementation implementation = registry.getDOMImplementation("XML 1.0"); DocumentType type = implementation.createDocumentType(pName, null, null); Document document = implementation.createDocument(null, pname, type);
Alternatively, use a less flexible XML factory interface like JDOM :) (I always found the Java W3C DOM API - a complete pain to work with.)
Another alternative is to use a specific DOMImplementation, but make it external, rather than relying on an implementation built into the JDK. It can be Apache Xerces , only from the jar file.
source share