Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv1938/src/com/meterware/httpunit
Modified Files:
HTMLPage.java WebTable.java
Log Message:
Hans-Joerg Hessmann: Speed up table searches
Index: HTMLPage.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HTMLPage.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- HTMLPage.java 5 Aug 2002 17:34:25 -0000 1.4
+++ HTMLPage.java 6 Aug 2002 21:42:08 -0000 1.5
@@ -84,7 +84,6 @@
* <code>
* <link type="text/css" rel="stylesheet" href="/mystyle.css" />
* </code>
- * @author <a href="mailto:bx...@bi...">Benoit Xhenseval</a>
**/
public String getExternalStyleSheet() throws SAXException {
NodeList nl = ((Document) getOriginalDOM()).getElementsByTagName( "link" );
Index: WebTable.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebTable.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- WebTable.java 1 Aug 2002 14:58:59 -0000 1.17
+++ WebTable.java 6 Aug 2002 21:42:08 -0000 1.18
@@ -395,10 +395,13 @@
static void processChildren( Element root, String childTag, String avoidingParentTag, ElementHandler handler ) {
- NodeList nl = root.getElementsByTagName( childTag );
- for (int i = 0; i < nl.getLength(); i++) {
- if (isMoreCloselyNested( nl.item(i), root, avoidingParentTag )) {
- handler.handleElement( (Element) nl.item(i) );
+
+ for (Node child = root.getFirstChild(); child != null; child = child.getNextSibling()) {
+ if (child instanceof Element) {
+ Element element = (Element) child;
+ String name = child.getNodeName();
+ if (name.equalsIgnoreCase( childTag )) handler.handleElement( element );
+ if (!name.equalsIgnoreCase( avoidingParentTag )) processChildren( element, childTag, avoidingParentTag, handler );
}
}
}
|