tags:

views:

41

answers:

1

I have Xerces and Oracle XML parsers both in my application's classpath (don't ask why).

When I create a new javax.xml.parsers.DocumentBuilderFactory, the classloader automatically picks up the Oracle XML parser. However, it's not a full/proper implementation, so it's giving me headaches.

Is there a way I can force/tell the classloader to use the Xerces parces when constructing the document builder factory?

+3  A: 

DocumentBuilderFactory has a [newInstance()][1] method where you can specify the class name of the implementation you want to use (see [javadoc][2]).

[2]: http://download.oracle.com/docs/cd/E17409_01/javase/6/docs/api/javax/xml/parsers/DocumentBuilderFactory.html#newInstance(java.lang.String, java.lang.ClassLoader)

skaffman
Thank you very much! I should've RTFM.
dasp