# HG changeset patch # User Sascha L. Teichmann # Date 1365197268 -7200 # Node ID 4b281c7046c86e102d590f3874b26a82baad94dd # Parent d35a0bc153fa4722419b633edc9bf045966a0fb3 Used DOM instead of XPath to extract main values. diff -r d35a0bc153fa -r 4b281c7046c8 flys-client/src/main/java/de/intevation/flys/client/server/WQInfoServiceImpl.java --- a/flys-client/src/main/java/de/intevation/flys/client/server/WQInfoServiceImpl.java Fri Apr 05 23:19:01 2013 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/WQInfoServiceImpl.java Fri Apr 05 23:27:48 2013 +0200 @@ -131,7 +131,7 @@ new ArrayList(num); for (int i = 0; i < num; i++) { - WQInfoObject obj = buildWQInfoObject(list.item(i)); + WQInfoObject obj = buildWQInfoObject((Element)list.item(i)); if (obj != null) { objects.add(obj); @@ -176,20 +176,15 @@ * * @return a valid WQInfoObject. */ - protected WQInfoObject buildWQInfoObject(Node node) { - - // TODO: Replace this expensive XPaths with simpler use of DOM. - String name = XMLUtils.xpathString( - node, "@name", ArtifactNamespaceContext.INSTANCE); + protected static WQInfoObject buildWQInfoObject(Element node) { - String type = XMLUtils.xpathString( - node, "@type", ArtifactNamespaceContext.INSTANCE); + String uri = ArtifactNamespaceContext.NAMESPACE_URI; - String value = XMLUtils.xpathString( - node, "@value", ArtifactNamespaceContext.INSTANCE); + String name = node.getAttributeNS(uri, "name"); + String type = node.getAttributeNS(uri, "type"); + String value = node.getAttributeNS(uri, "value"); - - if (name != null && type != null) { + if (!name.isEmpty() && !type.isEmpty()) { try { return new WQInfoObjectImpl( name,