diff gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java @ 389:416ff31f6273

Removed local-name() method from xsl stylesheet and adjusted xpathes while reading xml documents. gnv/trunk@511 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 06 Jan 2010 09:13:45 +0000
parents 4ec95d586f31
children ee8003fffc71
line wrap: on
line diff
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java	Tue Jan 05 08:52:49 2010 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java	Wed Jan 06 09:13:45 2010 +0000
@@ -128,21 +128,22 @@
                                                             String server) {
         XMLUtils xmlUtils = new XMLUtils();
         NodeList artifactFactories = xmlUtils.getNodeSetXPath(document,
-                "/result/factories/factory");
+                "/art:result/art:factories/art:factory");
         Collection<ArtifactObject> resultValues = new ArrayList<ArtifactObject>(
                 artifactFactories.getLength());
         if (artifactFactories != null) {
             for (int i = 0; i < artifactFactories.getLength(); i++) {
                 Node artifactFactoryNode = artifactFactories.item(i);
                 String name = xmlUtils.getStringXPath(artifactFactoryNode,
-                        "@name");
+                        "@art:name");
                 String description = xmlUtils.getStringXPath(
-                        artifactFactoryNode, "@description");
+                        artifactFactoryNode, "@art:description");
                 ArtifactFactory artifactFactory = new ArtifactFactory(name,
                         description, server);
                 resultValues.add(artifactFactory);
             }
         }
+        log.debug("Artifact Factories: " + resultValues.size());
         return resultValues;
     }
 
@@ -265,8 +266,8 @@
 
     private ArtifactObject getArtifact(Document document) {
         XMLUtils xmlUtils = new XMLUtils();
-        String uuid = xmlUtils.getStringXPath(document, "/result/uuid/@value");
-        String hash = xmlUtils.getStringXPath(document, "/result/hash/@value");
+        String uuid = xmlUtils.getStringXPath(document, "/art:result/art:uuid/@value");
+        String hash = xmlUtils.getStringXPath(document, "/art:result/art:hash/@value");
         log.info("NEW Artifact: " + uuid + " / " + hash);
         return new Artifact(uuid, hash);
     }
@@ -387,14 +388,14 @@
         XMLUtils xmlUtils = new XMLUtils();
         if (artifact instanceof ArtifactDescription) {
             ArtifactDescription ad = (ArtifactDescription) artifact;
-            Node uiNode = xmlUtils.getNodeXPath(document, "/result/ui");
+            Node uiNode = xmlUtils.getNodeXPath(document, "/art:result/art:ui");
             Node outputNode = xmlUtils
-                    .getNodeXPath(document, "/result/outputs");
+                    .getNodeXPath(document, "/art:result/art:outputs");
 
             Map<String, OutputMode> outputModes = null;
             if (outputNode != null) {
                 NodeList outputModesNodes = xmlUtils.getNodeSetXPath(
-                        outputNode, "output");
+                        outputNode, "art:output");
                 if (outputModesNodes != null) {
                     outputModes = new HashMap<String, OutputMode>(
                             outputModesNodes.getLength());
@@ -406,7 +407,7 @@
                                 outputModeNode, "@mime-type");
 
                         NodeList parameterNodes = xmlUtils.getNodeSetXPath(
-                                outputModeNode, "parameter/parameter");
+                                outputModeNode, "art:parameter/art:parameter");
                         Collection<OutputParameter> parameter = null;
                         if (parameterNodes != null) {
                             parameter = new ArrayList<OutputParameter>(
@@ -433,9 +434,9 @@
             }
 
             String currentState = xmlUtils.getStringXPath(document,
-                    "/result/state/@name");
+                    "/art:result/art:state/@name");
             NodeList statesList = xmlUtils.getNodeSetXPath(document,
-                    "/result/reachable-states/state/@name");
+                    "/art:result/art:reachable-states/art:state/@name");
             Collection<String> reachableStates = new ArrayList<String>(
                     statesList.getLength());
             for (int i = 0; i < statesList.getLength(); i++) {
@@ -443,7 +444,7 @@
             }
 
             NodeList inputNodes = xmlUtils.getNodeSetXPath(document,
-                    "/result/model/input");
+                    "/art:result/art:model/art:input");
             if (inputNodes != null) {
                 Collection<String> inputParameter = new ArrayList<String>(
                         inputNodes.getLength());
@@ -707,7 +708,7 @@
             if (resultDocument != null) {
                 
                 NodeList statisticSetNodes = xmlUtils.getNodeSetXPath(resultDocument,
-                                                  "/statistics/statistic");
+                                                  "/art:statistics/art:statistic");
                 resultValues = new ArrayList<ArtifactStatisticsSet>
                                           (statisticSetNodes.getLength());
                 for (int i = 0; i < statisticSetNodes.getLength(); i++) {
@@ -716,7 +717,7 @@
                     ArtifactStatisticsSet set = 
                                new DefaultArtifactStatisticsSet(name);
                     NodeList resultNodes = xmlUtils.getNodeSetXPath(statisticSetNode,
-                            "statistic-value");
+                            "art:statistic-value");
                     if (resultNodes != null) {
                         for (int j = 0; j < resultNodes.getLength(); j++) {
                             Element statisticNode = (Element)resultNodes.item(j);

http://dive4elements.wald.intevation.org