1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| String CONFIG_FILE = "/conf/maConf.xml";
InputStream in = getClass().getResourceAsStream(CONFIG_FILE);
if(in==null) {
throw new IllegalStateException("Cannot find "+CONFIG_FILE);
}
ZipInputStream zip = new ZipInputStream(in);
if(zip==null) {
throw new IllegalStateException("Cannot find ZIP "+CONFIG_FILE);
}
InputSource sourceConf = new InputSource(zip);
if(sourceConf==null) {
throw new IllegalStateException("Cannot find InpurSource "+CONFIG_FILE);
}
System.out.println("1");
XPathFactory fabrique = XPathFactory.newInstance();
System.out.println("2");
XPath xpath = fabrique.newXPath();
System.out.println("3");
XPathExpression exp = xpath.compile("<expression XPATH>");
String param = (String)exp.evaluate(sourceConf,XPathConstants.STRING);
System.out.println("4"); |
Partager