Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/util
In directory sc8-pr-cvs1:/tmp/cvs-serv8834/org/htmlparser/util
Modified Files:
NodeList.java
Log Message:
Added recursive input and textarea harvesting to FormTag.
Index: NodeList.java
===================================================================
RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/util/NodeList.java,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -d -r1.36 -r1.37
*** NodeList.java 27 Jul 2003 19:19:24 -0000 1.36
--- NodeList.java 30 Jul 2003 03:06:02 -0000 1.37
***************
*** 33,36 ****
--- 33,37 ----
import org.htmlparser.Node;
+ import org.htmlparser.tags.CompositeTag;
public class NodeList implements Serializable {
***************
*** 58,61 ****
--- 59,72 ----
/**
+ * Add another node list to this one.
+ * @param list The list to add.
+ */
+ public void add (NodeList list)
+ {
+ for (int i = 0; i < list.size; i++)
+ add (list.nodeData[i]);
+ }
+
+ /**
* Insert the given node at the head of the list.
* @param node The new first element.
***************
*** 153,165 ****
return text.toString();
}
!
! public NodeList searchFor(Class classType) {
! NodeList foundList = new NodeList();
! Node node;
! for (int i=0;i<size;i++) {
! if (nodeData[i].getClass().getName().equals(classType.getName()))
! foundList.add(nodeData[i]);
! }
! return foundList;
! }
}
--- 164,200 ----
return text.toString();
}
!
! /**
! * Search for nodes of the given type non-recursively.
! * @param classType The class to search for.
! */
! public NodeList searchFor (Class classType)
! {
! return (searchFor (classType, false));
! }
!
! /**
! * Search for nodes of the given type recursively.
! * @param classType The class to search for.
! * @param recursive If <code>true<code> digs into the children recursively.
! */
! public NodeList searchFor (Class classType, boolean recursive)
! {
! String name;
! Node node;
! NodeList ret;
!
! ret = new NodeList ();
! name = classType.getName ();
! for (int i = 0; i < size; i++)
! {
! node = nodeData[i];
! if (node.getClass ().getName ().equals (name))
! ret.add (node);
! if (recursive && node instanceof CompositeTag)
! ret.add (((CompositeTag)node).getChildren ().searchFor (classType, recursive));
! }
!
! return (ret);
! }
}
|