package org.madore.damlengine; import java.util.Vector; import java.util.HashMap; import org.w3c.dom.*; public abstract class ElementHandler { public void handleAttributes(TodoElement that) { NamedNodeMap attrs = that.node.getAttributes(); Node attr; Vector toProcess = new Vector(); for ( int i=0 ; (attr=attrs.item(i)) != null ; i++ ) { TodoAttr it = new TodoAttr((Attr)attr, that.node, that.context, new HashMap()); toProcess.add(it); } that.ownerDeque.registerAtStart(toProcess); } public void handleNodeOnly(TodoElement that) { System.err.println("handling a "+that.node.getNodeName()+" element"); NodeList children = that.node.getChildNodes(); Node child; Vector toProcess = new Vector(); for ( int i=0 ; (child=children.item(i)) != null ; i++ ) { if ( child.getNodeType() == Node.ELEMENT_NODE ) { TodoElement it = new TodoElement((Element)child, that.context, new HashMap()); toProcess.add(it); } } that.ownerDeque.registerAtStart(toProcess); } public void handle(TodoElement that) { assert(that.ownerDeque != null); handleAttributes(that); handleNodeOnly(that); } }