[Dive4elements-commits] [PATCH] Rolled XPath replacement back for main values

Wald Commits scm-commit at wald.intevation.org
Mon Apr 8 16:43:00 CEST 2013


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1365432170 -7200
# Node ID 8fce357029084a69df6a1d0ff1d1b35f90adbb2c
# Parent  85fd42e308e78e0d0d19a77d877a8b7a57f44fae
Rolled XPath replacement back for main values.

diff -r 85fd42e308e7 -r 8fce35702908 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	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) {
+    protected static WQInfoObject buildWQInfoObject(Node node) {
 
-        String uri = ArtifactNamespaceContext.NAMESPACE_URI;
+        String name = XMLUtils.xpathString(
+            node, "@name", ArtifactNamespaceContext.INSTANCE);
 
-        String name  = node.getAttributeNS(uri, "name");
-        String type  = node.getAttributeNS(uri, "type");
-        String value = node.getAttributeNS(uri, "value");
+        String type = XMLUtils.xpathString(
+            node, "@type", ArtifactNamespaceContext.INSTANCE);
 
-        if (!name.isEmpty() && !type.isEmpty()) {
+        String value = XMLUtils.xpathString(
+            node, "@value", ArtifactNamespaceContext.INSTANCE);
+
+        if (name != null && type != null) {
             try {
                 return new WQInfoObjectImpl(
                     name,


More information about the Dive4elements-commits mailing list