Mercurial > dive4elements > framework
annotate artifact-database/src/main/java/de/intevation/artifactdatabase/XMLUtils.java @ 62:76abf0c64d3b
Added XML utils method to load XML file from file.
artifacts/trunk@438 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 16 Dec 2009 08:08:56 +0000 |
parents | 4ae4dc99127d |
children | 8b72676698b5 |
rev | line source |
---|---|
20
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.artifactdatabase; |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 import org.w3c.dom.Document; |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 import org.w3c.dom.Element; |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 import org.w3c.dom.Attr; |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 |
62
76abf0c64d3b
Added XML utils method to load XML file from file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
7 import org.xml.sax.SAXException; |
76abf0c64d3b
Added XML utils method to load XML file from file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
8 |
20
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 import javax.xml.parsers.DocumentBuilderFactory; |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 import javax.xml.parsers.ParserConfigurationException; |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
12 |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 import org.apache.log4j.Logger; |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 |
23
00596a591a2f
Added possibibilty to ceate XPaths with namespace contextes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
20
diff
changeset
|
15 import javax.xml.xpath.XPathFactory; |
00596a591a2f
Added possibibilty to ceate XPaths with namespace contextes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
20
diff
changeset
|
16 import javax.xml.xpath.XPath; |
25
ccc6aae25585
Moved some XPath stuff from Config into XMLUtils.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
23
diff
changeset
|
17 import javax.xml.xpath.XPathExpressionException; |
26
83a059c204f8
Connected /create with artifact db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
25
diff
changeset
|
18 import javax.xml.xpath.XPathConstants; |
23
00596a591a2f
Added possibibilty to ceate XPaths with namespace contextes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
20
diff
changeset
|
19 |
00596a591a2f
Added possibibilty to ceate XPaths with namespace contextes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
20
diff
changeset
|
20 import javax.xml.namespace.NamespaceContext; |
25
ccc6aae25585
Moved some XPath stuff from Config into XMLUtils.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
23
diff
changeset
|
21 import javax.xml.namespace.QName; |
23
00596a591a2f
Added possibibilty to ceate XPaths with namespace contextes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
20
diff
changeset
|
22 |
62
76abf0c64d3b
Added XML utils method to load XML file from file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
23 import java.io.File; |
76abf0c64d3b
Added XML utils method to load XML file from file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
24 import java.io.IOException; |
76abf0c64d3b
Added XML utils method to load XML file from file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
25 |
20
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 /** |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 * @author Sascha L. Teichmann |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
28 */ |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
29 public final class XMLUtils |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
30 { |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 private static Logger logger = Logger.getLogger(XMLUtils.class); |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
33 private XMLUtils() { |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
34 } |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
35 |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
36 public static class ElementCreator |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
37 { |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
38 protected Document document; |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
39 protected String ns; |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
40 protected String prefix; |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
41 |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
42 public ElementCreator(Document document, String ns, String prefix) { |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 this.document = document; |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
44 this.ns = ns; |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
45 this.prefix = prefix; |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
46 } |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
48 public Element create(String name) { |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
49 Element element = document.createElementNS(ns, name); |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
50 element.setPrefix(prefix); |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
51 return element; |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
52 } |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
53 |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
54 public void addAttr(Element element, String name, String value) { |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
55 Attr attr = document.createAttributeNS(ns, name); |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
56 attr.setValue(value); |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
57 attr.setPrefix(prefix); |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
58 element.setAttributeNode(attr); |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
59 } |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
60 } // class ElementCreator |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
61 |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
62 public static final Document newDocument() { |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
63 try { |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
64 return DocumentBuilderFactory |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
65 .newInstance() |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
66 .newDocumentBuilder() |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
67 .newDocument(); |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
68 } |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
69 catch (ParserConfigurationException pce) { |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
70 logger.error(pce.getLocalizedMessage(), pce); |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
71 } |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
72 return null; |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
73 } |
23
00596a591a2f
Added possibibilty to ceate XPaths with namespace contextes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
20
diff
changeset
|
74 |
62
76abf0c64d3b
Added XML utils method to load XML file from file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
75 public static final Document parseDocument(File file) { |
76abf0c64d3b
Added XML utils method to load XML file from file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
76 try { |
76abf0c64d3b
Added XML utils method to load XML file from file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
77 return DocumentBuilderFactory |
76abf0c64d3b
Added XML utils method to load XML file from file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
78 .newInstance() |
76abf0c64d3b
Added XML utils method to load XML file from file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
79 .newDocumentBuilder() |
76abf0c64d3b
Added XML utils method to load XML file from file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
80 .parse(file); |
76abf0c64d3b
Added XML utils method to load XML file from file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
81 } |
76abf0c64d3b
Added XML utils method to load XML file from file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
82 catch (ParserConfigurationException pce) { |
76abf0c64d3b
Added XML utils method to load XML file from file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
83 logger.error(pce.getLocalizedMessage(), pce); |
76abf0c64d3b
Added XML utils method to load XML file from file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
84 } |
76abf0c64d3b
Added XML utils method to load XML file from file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
85 catch (SAXException se) { |
76abf0c64d3b
Added XML utils method to load XML file from file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
86 logger.error(se.getLocalizedMessage(), se); |
76abf0c64d3b
Added XML utils method to load XML file from file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
87 } |
76abf0c64d3b
Added XML utils method to load XML file from file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
88 catch (IOException ioe) { |
76abf0c64d3b
Added XML utils method to load XML file from file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
89 logger.error(ioe.getLocalizedMessage(), ioe); |
76abf0c64d3b
Added XML utils method to load XML file from file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
90 } |
76abf0c64d3b
Added XML utils method to load XML file from file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
91 return null; |
76abf0c64d3b
Added XML utils method to load XML file from file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
92 } |
76abf0c64d3b
Added XML utils method to load XML file from file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
47
diff
changeset
|
93 |
23
00596a591a2f
Added possibibilty to ceate XPaths with namespace contextes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
20
diff
changeset
|
94 public static final XPath newXPath() { |
00596a591a2f
Added possibibilty to ceate XPaths with namespace contextes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
20
diff
changeset
|
95 return newXPath(null); |
00596a591a2f
Added possibibilty to ceate XPaths with namespace contextes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
20
diff
changeset
|
96 } |
00596a591a2f
Added possibibilty to ceate XPaths with namespace contextes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
20
diff
changeset
|
97 |
00596a591a2f
Added possibibilty to ceate XPaths with namespace contextes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
20
diff
changeset
|
98 public static final XPath newXPath(NamespaceContext namespaceContext) { |
00596a591a2f
Added possibibilty to ceate XPaths with namespace contextes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
20
diff
changeset
|
99 XPathFactory factory = XPathFactory.newInstance(); |
00596a591a2f
Added possibibilty to ceate XPaths with namespace contextes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
20
diff
changeset
|
100 XPath xpath = factory.newXPath(); |
00596a591a2f
Added possibibilty to ceate XPaths with namespace contextes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
20
diff
changeset
|
101 if (namespaceContext != null) { |
00596a591a2f
Added possibibilty to ceate XPaths with namespace contextes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
20
diff
changeset
|
102 xpath.setNamespaceContext(namespaceContext); |
00596a591a2f
Added possibibilty to ceate XPaths with namespace contextes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
20
diff
changeset
|
103 } |
00596a591a2f
Added possibibilty to ceate XPaths with namespace contextes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
20
diff
changeset
|
104 return xpath; |
00596a591a2f
Added possibibilty to ceate XPaths with namespace contextes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
20
diff
changeset
|
105 } |
25
ccc6aae25585
Moved some XPath stuff from Config into XMLUtils.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
23
diff
changeset
|
106 |
ccc6aae25585
Moved some XPath stuff from Config into XMLUtils.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
23
diff
changeset
|
107 public static final Object xpath(Object root, String query, QName returnTyp) { |
ccc6aae25585
Moved some XPath stuff from Config into XMLUtils.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
23
diff
changeset
|
108 return xpath(root, query, returnTyp, null); |
ccc6aae25585
Moved some XPath stuff from Config into XMLUtils.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
23
diff
changeset
|
109 } |
ccc6aae25585
Moved some XPath stuff from Config into XMLUtils.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
23
diff
changeset
|
110 |
26
83a059c204f8
Connected /create with artifact db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
25
diff
changeset
|
111 public static final String xpathString( |
83a059c204f8
Connected /create with artifact db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
25
diff
changeset
|
112 Object root, String query, NamespaceContext namespaceContext |
83a059c204f8
Connected /create with artifact db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
25
diff
changeset
|
113 ) { |
83a059c204f8
Connected /create with artifact db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
25
diff
changeset
|
114 return (String)xpath(root, query, XPathConstants.STRING, namespaceContext); |
83a059c204f8
Connected /create with artifact db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
25
diff
changeset
|
115 } |
83a059c204f8
Connected /create with artifact db.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
25
diff
changeset
|
116 |
25
ccc6aae25585
Moved some XPath stuff from Config into XMLUtils.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
23
diff
changeset
|
117 public static final Object xpath( |
ccc6aae25585
Moved some XPath stuff from Config into XMLUtils.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
23
diff
changeset
|
118 Object root, |
ccc6aae25585
Moved some XPath stuff from Config into XMLUtils.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
23
diff
changeset
|
119 String query, |
ccc6aae25585
Moved some XPath stuff from Config into XMLUtils.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
23
diff
changeset
|
120 QName returnType, |
ccc6aae25585
Moved some XPath stuff from Config into XMLUtils.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
23
diff
changeset
|
121 NamespaceContext namespaceContext |
ccc6aae25585
Moved some XPath stuff from Config into XMLUtils.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
23
diff
changeset
|
122 ) { |
ccc6aae25585
Moved some XPath stuff from Config into XMLUtils.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
23
diff
changeset
|
123 if (root == null) { |
ccc6aae25585
Moved some XPath stuff from Config into XMLUtils.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
23
diff
changeset
|
124 return null; |
ccc6aae25585
Moved some XPath stuff from Config into XMLUtils.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
23
diff
changeset
|
125 } |
ccc6aae25585
Moved some XPath stuff from Config into XMLUtils.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
23
diff
changeset
|
126 |
ccc6aae25585
Moved some XPath stuff from Config into XMLUtils.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
23
diff
changeset
|
127 try { |
ccc6aae25585
Moved some XPath stuff from Config into XMLUtils.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
23
diff
changeset
|
128 XPath xpath = newXPath(namespaceContext); |
ccc6aae25585
Moved some XPath stuff from Config into XMLUtils.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
23
diff
changeset
|
129 if (xpath != null) { |
ccc6aae25585
Moved some XPath stuff from Config into XMLUtils.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
23
diff
changeset
|
130 return xpath.evaluate(query, root, returnType); |
ccc6aae25585
Moved some XPath stuff from Config into XMLUtils.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
23
diff
changeset
|
131 } |
ccc6aae25585
Moved some XPath stuff from Config into XMLUtils.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
23
diff
changeset
|
132 } |
ccc6aae25585
Moved some XPath stuff from Config into XMLUtils.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
23
diff
changeset
|
133 catch (XPathExpressionException xpee) { |
ccc6aae25585
Moved some XPath stuff from Config into XMLUtils.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
23
diff
changeset
|
134 logger.error(xpee.getLocalizedMessage(), xpee); |
47
4ae4dc99127d
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
26
diff
changeset
|
135 } |
25
ccc6aae25585
Moved some XPath stuff from Config into XMLUtils.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
23
diff
changeset
|
136 |
ccc6aae25585
Moved some XPath stuff from Config into XMLUtils.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
23
diff
changeset
|
137 return null; |
ccc6aae25585
Moved some XPath stuff from Config into XMLUtils.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
23
diff
changeset
|
138 } |
20
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
139 } |
ff666592c1c3
Added factory listing '/factories' to web app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
140 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: |