Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/util
In directory sc8-pr-cvs1:/tmp/cvs-serv11047/util
Modified Files:
LinkProcessor.java
Log Message:
Fixed up the broken visitor logic.
Added some docos on NodeVisitor.
Index: LinkProcessor.java
===================================================================
RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/util/LinkProcessor.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** LinkProcessor.java 22 Sep 2003 02:40:15 -0000 1.27
--- LinkProcessor.java 28 Sep 2003 19:30:04 -0000 1.28
***************
*** 70,73 ****
--- 70,75 ----
if (null == link)
link = "";
+ else
+ link = stripQuotes (link);
if (null != getBaseUrl ())
base = getBaseUrl ();
***************
*** 88,91 ****
--- 90,109 ----
}
+ /**
+ * Remove double or single quotes from the string.
+ */
+ public String stripQuotes (String string)
+ {
+ //remove any double quotes from around charset string
+ if (string.startsWith ("\"") && string.endsWith ("\"") && (1 < string.length ()))
+ string = string.substring (1, string.length () - 1);
+
+ //remove any single quote from around charset string
+ if (string.startsWith ("'") && string.endsWith ("'") && (1 < string.length ()))
+ string = string.substring (1, string.length () - 1);
+
+ return (string);
+ }
+
public URL constructUrl(String link, String base)
throws MalformedURLException {
|