[Httpunit-commit] CVS: httpunit/src/com/meterware/httpunit ReceivedPage.java,1.14,1.15
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2001-10-26 15:41:07
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv14392/src/com/meterware/httpunit
Modified Files:
ReceivedPage.java
Log Message:
from Benoit Xhenseval: handle cases of multiple Link elements
Index: ReceivedPage.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/ReceivedPage.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- ReceivedPage.java 2001/10/25 14:51:05 1.14
+++ ReceivedPage.java 2001/10/26 15:41:04 1.15
@@ -68,9 +68,13 @@
**/
public String getExternalStyleSheet() throws SAXException {
NodeList nl = ((Document) getDOM()).getElementsByTagName( "link" );
- if (nl.getLength() == 0) return "";
- if ("stylesheet".equalsIgnoreCase(NodeUtils.getNodeAttribute( nl.item(0), "rel" )))
- return NodeUtils.getNodeAttribute( nl.item(0), "href" );
+ int length = nl.getLength();
+ if (length == 0) return "";
+
+ for (int i = 0; i < length; i++) {
+ if ("stylesheet".equalsIgnoreCase(NodeUtils.getNodeAttribute( nl.item(i), "rel" )))
+ return NodeUtils.getNodeAttribute( nl.item(i), "href" );
+ }
return "";
}
|