views:

1244

answers:

1

I am not sure if a URLClassLoader can be used. Also, only the relative path of the XML is known.

Thank You.

+1  A: 

If you just mean read in an XML file that is already on the classpath, so that you can parse it using whatever library you prefer, the most compact way is using a ClassLoader:

InputStream is = ClassLoader.getResourceAsStream();
// use the input stream however you want
is.close()

See http://java.sun.com/javase/6/docs/api/java/lang/ClassLoader.html

Alabaster Codify