summaryrefslogtreecommitdiffstats
path: root/org/madore
diff options
context:
space:
mode:
Diffstat (limited to 'org/madore')
-rw-r--r--org/madore/damlengine/TodoDefaultElement.java34
1 files changed, 25 insertions, 9 deletions
diff --git a/org/madore/damlengine/TodoDefaultElement.java b/org/madore/damlengine/TodoDefaultElement.java
index fd916e3..50a460f 100644
--- a/org/madore/damlengine/TodoDefaultElement.java
+++ b/org/madore/damlengine/TodoDefaultElement.java
@@ -19,13 +19,30 @@ public class TodoDefaultElement extends TodoElement {
super(node, context, options);
}
- public void handleAttributes() {
- NamedNodeMap attrs = this.node.getAttributes();
+ public static ArrayList<Attr> getAttrList(Element node) {
+ NamedNodeMap attrs = node.getAttributes();
+ ArrayList<Attr> attrList = new ArrayList<Attr>(attrs.getLength());
Node attr;
- ArrayList<TodoAttr> toProcess = new ArrayList<TodoAttr>();
- for ( int i=0 ; (attr=attrs.item(i)) != null ; i++ ) {
+ for ( int i=0 ; (attr=attrs.item(i)) != null ; i++ )
+ attrList.add((Attr)attr);
+ return attrList;
+ }
+
+ public static ArrayList<Node> getChildList(Element node) {
+ NodeList children = node.getChildNodes();
+ ArrayList<Node> childList = new ArrayList<Node>(children.getLength());
+ Node child;
+ for ( int i=0 ; (child=children.item(i)) != null ; i++ )
+ childList.add(child);
+ return childList;
+ }
+
+ public void handleAttributes() {
+ ArrayList<Attr> attrList = getAttrList(this.node);
+ ArrayList<TodoAttr> toProcess = new ArrayList<TodoAttr>(attrList.size());
+ for ( Attr attr : attrList ) {
TodoAttr it
- = TodoAttr.getTodoAttr((Attr)attr, this.node, this.context,
+ = TodoAttr.getTodoAttr(attr, this.node, this.context,
new TodoItem.Options());
if ( it != null )
toProcess.add(it);
@@ -35,10 +52,9 @@ public class TodoDefaultElement extends TodoElement {
public void handleNodeOnly() {
System.err.println("handling a "+this.node.getNodeName()+" element");
- NodeList children = this.node.getChildNodes();
- Node child;
- ArrayList<TodoElement> toProcess = new ArrayList<TodoElement>();
- for ( int i=0 ; (child=children.item(i)) != null ; i++ ) {
+ ArrayList<Node> childList = getChildList(this.node);
+ ArrayList<TodoElement> toProcess = new ArrayList<TodoElement>(childList.size());
+ for ( Node child : childList ) {
if ( child.getNodeType() == Node.ELEMENT_NODE ) {
TodoElement it
= TodoElement.getTodoElement((Element)child, this.context,