سؤال

I am trying to change a project to work on jre 1.7. But when I change the referenced library, I get an error with the following:

DocumentBuildFactory documentBuildFactory = (DocumentBuilderFactory) = new  org.apache.xerces.jaxp.DocumentBuilderFactoryImpl();

Any ideas why? as I didn't think it was deprecated.

The error I am getting is org.apache.xerces cannot be resolved to a type

هل كانت مفيدة؟

المحلول

Don't instantiate an org.apache.xerces.jaxp.DocumentBuilderFactoryImpl directly. Always use DocumentBuilderFactory.newInstance, which will use (among other things) the Services API to locate the actual DocumentBuilderFactory to instantiate.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top