changeset 5494:773899d00234

Fix new attribute evaluation Patch written by Sascha Teichmann
author Andre Heinecke <aheinecke@intevation.de>
date Thu, 28 Mar 2013 12:04:53 +0100
parents 2be02d6ad9dc
children 1488227b97b7
files flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/Builder.java
diffstat 1 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/Builder.java	Thu Mar 28 10:57:15 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/Builder.java	Thu Mar 28 12:04:53 2013 +0100
@@ -32,6 +32,7 @@
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
+import org.w3c.dom.NamedNodeMap;
 
 
 /** Handles and evaluate meta-data template against dbs. */
@@ -721,13 +722,17 @@
 
             Node copy = owner.importNode(current, false);
 
-            if (copy.getNodeType() == Node.ATTRIBUTE_NODE) {
-                evaluateAttributeValue((Attr)copy);
+            NodeList children = current.getChildNodes();
+            for (int i = 0, N = children.getLength(); i < N; ++i) {
+                build(copy, children.item(i));
             }
-            else {
-                NodeList children = current.getChildNodes();
-                for (int i = 0, N = children.getLength(); i < N; ++i) {
-                    build(copy, children.item(i));
+            if (copy.getNodeType() == Node.ELEMENT_NODE) {
+                NamedNodeMap nnm = ((Element)copy).getAttributes();
+                for (int i = 0, N = nnm.getLength(); i < N; ++i) {
+                    Node n = nnm.item(i);
+                    if (n.getNodeType() == Node.ATTRIBUTE_NODE) {
+                        evaluateAttributeValue((Attr)n);
+                    }
                 }
             }
             parent.appendChild(copy);

http://dive4elements.wald.intevation.org