diff options
Diffstat (limited to 'org/madore/damlengine/DefaultHandler.java')
-rw-r--r-- | org/madore/damlengine/DefaultHandler.java | 27 |
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); + } + } |