Mercurial > dive4elements > river
changeset 5596:8fce35702908
Rolled XPath replacement back for main values.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Mon, 08 Apr 2013 16:42:50 +0200 |
parents | 85fd42e308e7 |
children | 085711915cc4 |
files | flys-client/src/main/java/de/intevation/flys/client/server/WQInfoServiceImpl.java |
diffstat | 1 files changed, 12 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/server/WQInfoServiceImpl.java Mon Apr 08 16:24:08 2013 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/WQInfoServiceImpl.java Mon Apr 08 16:42:50 2013 +0200 @@ -9,6 +9,7 @@ import org.w3c.dom.Document; import org.w3c.dom.Element; +import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.apache.log4j.Logger; @@ -130,7 +131,7 @@ new ArrayList<WQInfoObject>(num); for (int i = 0; i < num; i++) { - WQInfoObject obj = buildWQInfoObject((Element)list.item(i)); + WQInfoObject obj = buildWQInfoObject(list.item(i)); if (obj != null) { objects.add(obj); @@ -175,15 +176,18 @@ * * @return a valid WQInfoObject. */ - protected static WQInfoObject buildWQInfoObject(Element node) { - - String uri = ArtifactNamespaceContext.NAMESPACE_URI; + protected static WQInfoObject buildWQInfoObject(Node node) { - String name = node.getAttributeNS(uri, "name"); - String type = node.getAttributeNS(uri, "type"); - String value = node.getAttributeNS(uri, "value"); + String name = XMLUtils.xpathString( + node, "@name", ArtifactNamespaceContext.INSTANCE); - if (!name.isEmpty() && !type.isEmpty()) { + String type = XMLUtils.xpathString( + node, "@type", ArtifactNamespaceContext.INSTANCE); + + String value = XMLUtils.xpathString( + node, "@value", ArtifactNamespaceContext.INSTANCE); + + if (name != null && type != null) { try { return new WQInfoObjectImpl( name,