summaryrefslogtreecommitdiffstats
path: root/org/madore/damlengine/DefaultHandler.java
diff options
context:
space:
mode:
authorDavid A. Madore <david@procyon.(none)>2010-04-13 15:21:41 +0200
committerDavid A. Madore <david@procyon.(none)>2010-04-13 15:21:41 +0200
commite3b7a9c657a6a5f5a7a8f3c7ee4fdff1aee6410f (patch)
tree9a7f411ce9333aa6c67cd66522f4aaf60c35d194 /org/madore/damlengine/DefaultHandler.java
parent734a0b78ea5508f243caf18a50e36ac8918e11db (diff)
downloaddamlengine-e3b7a9c657a6a5f5a7a8f3c7ee4fdff1aee6410f.tar.gz
damlengine-e3b7a9c657a6a5f5a7a8f3c7ee4fdff1aee6410f.tar.bz2
damlengine-e3b7a9c657a6a5f5a7a8f3c7ee4fdff1aee6410f.zip
Framework for handling attributes.
Diffstat (limited to 'org/madore/damlengine/DefaultHandler.java')
-rw-r--r--org/madore/damlengine/DefaultHandler.java27
1 files changed, 22 insertions, 5 deletions
diff --git a/org/madore/damlengine/DefaultHandler.java b/org/madore/damlengine/DefaultHandler.java
index 4720f67..ae23a3b 100644
--- a/org/madore/damlengine/DefaultHandler.java
+++ b/org/madore/damlengine/DefaultHandler.java
@@ -8,19 +8,36 @@ public class DefaultHandler {
private DefaultHandler() { }
- public static void handle(TodoItem that) {
- System.err.println("handling a "+that.node.getNodeName()+" node");
+ public static void handleAttributes(TodoElement that) {
+ NamedNodeMap attrs = that.node.getAttributes();
+ Node attr;
+ Vector<TodoAttr> toProcess = new Vector<TodoAttr>();
+ for ( int i=0 ; (attr=attrs.item(i)) != null ; i++ ) {
+ TodoAttr it = new TodoAttr((Attr)attr, that.node, that.context,
+ new HashMap<String,Object>());
+ toProcess.add(it);
+ }
+ TodoDeque.registerAtStart(toProcess);
+ }
+
+ public static void handleNodeOnly(TodoElement that) {
+ System.err.println("handling a "+that.node.getNodeName()+" element");
NodeList children = that.node.getChildNodes();
Node child;
- Vector<TodoItem> toProcess = new Vector<TodoItem>();
+ Vector<TodoElement> toProcess = new Vector<TodoElement>();
for ( int i=0 ; (child=children.item(i)) != null ; i++ ) {
if ( child.getNodeType() == Node.ELEMENT_NODE ) {
- TodoItem it = new TodoItem(child, that.context,
- new HashMap<String,Object>());
+ TodoElement it = new TodoElement((Element)child, that.context,
+ new HashMap<String,Object>());
toProcess.add(it);
}
}
TodoDeque.registerAtStart(toProcess);
}
+ public static void handle(TodoElement that) {
+ handleAttributes(that);
+ handleNodeOnly(that);
+ }
+
}