[Yanel-commits] rev 22596 -
public/yanel/trunk/src/core/java/org/wyona/yanel/core
michi at wyona.com
michi at wyona.com
Mon Feb 12 21:39:27 CET 2007
Author: michi
Date: 2007-02-12 21:39:26 +0100 (Mon, 12 Feb 2007)
New Revision: 22596
Modified:
public/yanel/trunk/src/core/java/org/wyona/yanel/core/ResourceConfiguration.java
Log:
copy children and attributes
Modified: public/yanel/trunk/src/core/java/org/wyona/yanel/core/ResourceConfiguration.java
===================================================================
--- public/yanel/trunk/src/core/java/org/wyona/yanel/core/ResourceConfiguration.java 2007-02-12 20:14:32 UTC (rev 22595)
+++ public/yanel/trunk/src/core/java/org/wyona/yanel/core/ResourceConfiguration.java 2007-02-12 20:39:26 UTC (rev 22596)
@@ -26,6 +26,9 @@
import org.apache.log4j.Category;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
/**
* Abstraction of a resource configuration.
*/
@@ -146,8 +149,10 @@
Configuration[] children = customConfig.getChildren();
if (children.length > 0) {
+ Element rootElement = doc.getDocumentElement();
for (int i = 0; i < children.length; i++) {
log.error("DEBUG: child: " + children[i].getName());
+ rootElement.appendChild(createElement(children[i], doc));
}
}
} catch(Exception e) {
@@ -169,4 +174,22 @@
}
return null;
}
+
+ /**
+ *
+ */
+ private Element createElement(Configuration config, Document doc) throws Exception {
+ Element element = doc.createElementNS(config.getNamespace(), config.getName());
+ String[] attrs = config.getAttributeNames();
+ for (int i = 0; i < attrs.length; i++) {
+ element.setAttributeNS(config.getNamespace(), attrs[i], config.getAttribute(attrs[i]));
+ }
+ Configuration[] children = config.getChildren();
+ if (children.length > 0) {
+ for (int i = 0; i < children.length; i++) {
+ element.appendChild(createElement(children[i], doc));
+ }
+ }
+ return element;
+ }
}
More information about the Yanel-commits
mailing list