Вопрос

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