diff src/main/java/de/intevation/artifacts/httpclient/utils/ArtifactProtocolUtils.java @ 27:73b211b559e2

Replaced some XPath attribute extraction by simple DOM getAttributeNS() calls. http-client/trunk@2534 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 23 Aug 2011 13:49:16 +0000
parents a1db30b33f43
children 68163c3ca407
line wrap: on
line diff
--- a/src/main/java/de/intevation/artifacts/httpclient/utils/ArtifactProtocolUtils.java	Mon Jul 04 10:17:22 2011 +0000
+++ b/src/main/java/de/intevation/artifacts/httpclient/utils/ArtifactProtocolUtils.java	Tue Aug 23 13:49:16 2011 +0000
@@ -17,7 +17,6 @@
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
-import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
 import de.intevation.artifacts.httpclient.objects.Artifact;
@@ -42,12 +41,14 @@
 
         ArtifactFactory[] facs = new ArtifactFactory[elements.getLength()];
 
-        for (int idx = 0; idx < elements.getLength(); idx++) {
-            Node factory = elements.item(idx);
-            String desc  = XMLUtils.getStringXPath(factory, "@art:description");
-            String name  = XMLUtils.getStringXPath(factory, "@art:name");
+        String uri = ArtifactNamespaceContext.NAMESPACE_URI;
 
-            if (name != null) {
+        for (int idx = 0, N = elements.getLength(); idx < N; idx++) {
+            Element factory = (Element)elements.item(idx);
+            String desc  = factory.getAttributeNS(uri, "description");
+            String name  = factory.getAttributeNS(uri, "name");
+
+            if (name.length() != 0) {
                 facs[idx] = new ArtifactFactory(name, desc);
             }
         }

http://dive4elements.wald.intevation.org