comparison artifact-database/src/main/java/de/intevation/artifactdatabase/Config.java @ 23:00596a591a2f

Added possibibilty to ceate XPaths with namespace contextes. artifacts/trunk@57 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 10 Sep 2009 08:14:03 +0000
parents 1259d192e3c3
children ccc6aae25585
comparison
equal deleted inserted replaced
22:72abee95fd64 23:00596a591a2f
13 13
14 import javax.xml.parsers.ParserConfigurationException; 14 import javax.xml.parsers.ParserConfigurationException;
15 15
16 import javax.xml.namespace.QName; 16 import javax.xml.namespace.QName;
17 17
18 import javax.xml.xpath.XPathFactory;
19 import javax.xml.xpath.XPath;
20 import javax.xml.xpath.XPathExpressionException; 18 import javax.xml.xpath.XPathExpressionException;
21 import javax.xml.xpath.XPathConstants; 19 import javax.xml.xpath.XPathConstants;
22 20
23 import org.apache.log4j.Logger; 21 import org.apache.log4j.Logger;
24 22
99 ) { 97 ) {
100 if (root == null) { 98 if (root == null) {
101 return null; 99 return null;
102 } 100 }
103 101
104 XPathFactory factory = XPathFactory.newInstance();
105 XPath xpath = factory.newXPath();
106
107 try { 102 try {
108 return xpath.evaluate(query, root, returnType); 103 return XMLUtils.newXPath().evaluate(query, root, returnType);
109 } 104 }
110 catch (XPathExpressionException xpee) { 105 catch (XPathExpressionException xpee) {
111 logger.error(xpee.getLocalizedMessage(), xpee); 106 logger.error(xpee.getLocalizedMessage(), xpee);
112 } 107 }
113 108

http://dive4elements.wald.intevation.org