import com.sun.org.apache.xerces.internal.dom.DOMImplementationImpl;
public static Document newDocument( String pName ) {
return DOMImplementationImpl.getDOMImplementation().createDocument(
null,
pName,
DOMImplementationImpl.getDOMImplementation().createDocumentType( pName, null, null ) );
}
I have encounter with below warnings in netbeans
warning: com.sun.org.apache.xerces.internal.dom.DOMImplementationImpl is Sun proprietary API and may be removed in a future release
return DOMImplementationImpl.getDOMImplementation().createDocument(
warning: com.sun.org.apache.xerces.internal.dom.DOMImplementationImpl is Sun proprietary API and may be removed in a future release DOMImplementationImpl.getDOMImplementation().createDocumentType( pName, null, null ) );
Don't refer to a concrete DOMImplementation. Instead, use:
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 rather less factory-heavy XML API, like JDOM :) (I've always found the Java W3C DOM API to be a complete pain to work with.)
Yet another alternative would be to use a concrete DOMImplementation, but make it an external one rather than relying on an implementation built into the JDK. This could still be Apache Xerces, just from a jar file.
The way to remove the warning is to avoid using internal, undocumented classes and methods from Sun in your code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With