Do not use com.sun.org.apache JAXP internal classes

The com.sun.org.apache JAXP packages are not available in the IBM Java 6 Runtime Environment. Do not use classes from these packages:

Note that the IBM Java 7 has added some of these internal APIs back to to the JRE to ease migration issues. It is still considered best practices to change your code to not use these internal APIs.

This rule flags the use of these packages once per project. Evaluate your application to determine the extent to which your application uses classes from these JAXP 1.3 internal packages.

If you want to continue to use the older JAXP implementation and internal classes, you can download the jar files you need and include them in your application. Java 6 and Java 7 include the JAXP 1.4 implementation using the javax.xml and the org.apache packages.

In this example, the import statement will be flagged.

import com.sun.org.apache.xerces.internal.jaxp.JAXPConstants;

....
DocumentBuilderFactory docBuilder =
DocumentBuilderFactory.newInstance();
docBuilder.setAttribute(JAXPConstants.JAXP_SCHEMA_LANGUAGE,
JAXPConstants.W3C_XML_SCHEMA;
...

The recommended fix is to use the Java Runtime Environment provided APIs as in this example.

import org.apache.xerces.jaxp.JAXPConstants;

....
DocumentBuilderFactory docBuilder =
DocumentBuilderFactory.newInstance();
docBuilder.setAttribute(JAXPConstants.JAXP_SCHEMA_LANGUAGE,
JAXPConstants.W3C_XML_SCHEMA;
...

See the following information: