diff flys-artifacts/src/main/java/de/intevation/flys/collections/AttributeParser.java @ 694:68c6c75a6f7c facets-slt

Add index and description of facets to collections describe document. flys-artifacts/branches/facets-slt@2136 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 16 Jun 2011 14:10:49 +0000
parents 9c565eb46f06
children 59ae2a823e73
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/collections/AttributeParser.java	Thu Jun 16 13:24:00 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/collections/AttributeParser.java	Thu Jun 16 14:10:49 2011 +0000
@@ -8,6 +8,7 @@
 import org.apache.log4j.Logger;
 
 import org.w3c.dom.Document;
+import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
@@ -99,39 +100,40 @@
 
         logger.debug("Output has " + num + " themes.");
 
-        for (int i = 0; i < num; i++) {
-            Node theme = themes.item(i);
+        String uri = ArtifactNamespaceContext.NAMESPACE_URI;
 
-            String name = XMLUtils.xpathString(
-                theme, "@art:facet", ArtifactNamespaceContext.INSTANCE);
+        for (int i = 0; i < num; i++) {
+            Element theme = (Element) themes.item(i);
 
+            String name  = theme.getAttributeNS(uri, "facet");
             if (name == null || name.length() == 0) {
                 continue;
             }
 
-            String uuid = XMLUtils.xpathString(
-                theme, "@art:artifact", ArtifactNamespaceContext.INSTANCE);
-
+            String uuid  = theme.getAttributeNS(uri, "artifact");
             if (uuid == null || uuid.length() == 0) {
                 continue;
             }
 
-            String pos = XMLUtils.xpathString(
-                theme, "@art:pos", ArtifactNamespaceContext.INSTANCE);
-
+            String pos  = theme.getAttributeNS(uri, "pos");
             if (pos == null || pos.length() == 0) {
                 continue;
             }
 
-            String active = XMLUtils.xpathString(
-                theme, "@art:active", ArtifactNamespaceContext.INSTANCE);
+            String index = theme.getAttributeNS(uri, "index");
+            if (index == null || index.length() == 0) {
+                continue;
+            }
 
+            String active = theme.getAttributeNS(uri, "active");
             if (active == null || active.length() == 0) {
                 continue;
             }
 
+            String description = theme.getAttributeNS(uri, "description");
+
             ManagedFacet item = new ManagedFacet(
-                name, "", uuid,
+                name, Integer.parseInt(index), description, uuid,
                 Integer.parseInt(pos),
                 Integer.parseInt(active));
 

http://dive4elements.wald.intevation.org