Saturday, 31 August 2013

java xml validation with relative path to glasshfish config folder

java xml validation with relative path to glasshfish config folder

I searched a lot but couldn't find anything. I want to validate a selected
xml file with an schema file. My problem is working relative path is
config folder of the Glassfish server. I tried to get url of the schema
file which I copied into same package of the class I run this code but
still I can't find the file. I only able to make it work is by copying the
file into server config file.
URL url = ClassLoader.getSystemResource("/schema.xsd");
File file = new File(url.getPath());
But url returns null. How can I find this file and even if I find I
believe file object can not be created because my relative path is
/home/user/glassfish3/glassfish/domains/domain1/config. Any ideas how to
solve this problem? Thnx for any help in advance.

No comments:

Post a Comment