[Httpunit-commit] CVS: httpunit/src/com/meterware/httpunit HTMLPage.java,1.29,1.30 HTMLSegment.java,
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2003-07-06 13:20:16
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv1853/src/com/meterware/httpunit
Modified Files:
HTMLPage.java HTMLSegment.java ParsedHTML.java
Log Message:
Added support for getNamedElements, getElementsWithName
Index: HTMLPage.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HTMLPage.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- HTMLPage.java 2 Apr 2003 15:31:04 -0000 1.29
+++ HTMLPage.java 6 Jul 2003 13:20:07 -0000 1.30
@@ -221,7 +221,7 @@
public ScriptableDelegate[] getElementsByName( String name ) {
- return getDelegates( HTMLPage.this.getElementsByName( name ) );
+ return getDelegates( HTMLPage.this.getElementsWithName( name ) );
}
Index: HTMLSegment.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HTMLSegment.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- HTMLSegment.java 23 Jun 2003 23:54:03 -0000 1.10
+++ HTMLSegment.java 6 Jul 2003 13:20:08 -0000 1.11
@@ -37,6 +37,18 @@
/**
+ * Returns the HTMLElements found in this segment with the specified name.
+ */
+ public HTMLElement[] getElementsWithName( String name ) throws SAXException;
+
+
+ /**
+ * Returns a list of HTML element names contained in this HTML section.
+ */
+ public String[] getElementNames() throws SAXException;
+
+
+ /**
* Returns the forms found in this HTML segment in the order in which they appear.
* @exception SAXException thrown if there is an error parsing the segment.
**/
Index: ParsedHTML.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/ParsedHTML.java,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- ParsedHTML.java 23 Jun 2003 23:54:03 -0000 1.49
+++ ParsedHTML.java 6 Jul 2003 13:20:08 -0000 1.50
@@ -161,11 +161,22 @@
}
-
- HTMLElement[] getElementsByName( String name ) {
+ /**
+ * Returns the HTML elements with the specified name.
+ */
+ public HTMLElement[] getElementsWithName( String name ) {
loadElements();
ArrayList elements = (ArrayList) _elementsByName.get( name );
return elements == null ? NO_ELEMENTS : (HTMLElement[]) elements.toArray( new HTMLElement[ elements.size() ] );
+ }
+
+
+ /**
+ * Returns a list of HTML element names contained in this HTML section.
+ */
+ public String[] getElementNames() {
+ loadElements();
+ return (String[]) _elementsByName.keySet().toArray( new String[ _elementsByName.size() ] );
}
|