[Httpunit-commit] CVS: httpunit/src/com/meterware/httpunit HttpUnitUtils.java,1.15,1.16 NodeUtils.ja
Brought to you by:
russgold
From: Russell G. <rus...@us...> - 2004-06-29 23:10:53
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12006/src/com/meterware/httpunit Modified Files: HttpUnitUtils.java NodeUtils.java Log Message: rfe #766768: getText() methods now translate <br> tags as newlines Index: HttpUnitUtils.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HttpUnitUtils.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- HttpUnitUtils.java 28 Jun 2004 23:18:16 -0000 1.15 +++ HttpUnitUtils.java 29 Jun 2004 23:10:44 -0000 1.16 @@ -2,7 +2,7 @@ /******************************************************************************************************************** * $Id$ * -* Copyright (c) 2000-2002, Russell Gold +* Copyright (c) 2000-2004, Russell Gold * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the Software without restriction, including without limitation @@ -206,12 +206,6 @@ } - private static String trimFromMiddle( String s, int ch ) { - int index = s.indexOf( ch ); - return s.substring( 0, index ) + s.substring( index+1 ); - } - - static class ClasspathEntityResolver implements EntityResolver { public InputSource resolveEntity( String publicID, String systemID ) { Index: NodeUtils.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/NodeUtils.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- NodeUtils.java 27 Jun 2004 19:29:15 -0000 1.19 +++ NodeUtils.java 29 Jun 2004 23:10:44 -0000 1.20 @@ -89,15 +89,12 @@ final StringBuffer sb = new StringBuffer(HttpUnitUtils.DEFAULT_TEXT_BUFFER_SIZE); NodeAction action = new NodeAction() { public boolean processElement( PreOrderTraversal traversal, Element node ) { - if (node.getNodeName().equalsIgnoreCase( "p" )) { + String nodeName = node.getNodeName().toLowerCase(); + if (nodeName.equals( "p" ) || nodeName.equals( "br" ) || nodeName.equalsIgnoreCase( "tr" )) { sb.append( "\n" ); - } else if (node.getNodeName().equalsIgnoreCase( "tr" )) { - sb.append( "\n" ); - } else if (node.getNodeName().equalsIgnoreCase( "td" )) { - sb.append( " | " ); - } else if (node.getNodeName().equalsIgnoreCase( "th" )) { + } else if (nodeName.equals( "td" ) || nodeName.equalsIgnoreCase( "th" )) { sb.append( " | " ); - } else if (node.getNodeName().equalsIgnoreCase( "img" ) && HttpUnitOptions.getImagesTreatedAsAltText()) { + } else if (nodeName.equals( "img" ) && HttpUnitOptions.getImagesTreatedAsAltText()) { sb.append( getNodeAttribute( node, "alt" ) ); } return true; |