[Htmlparser-developer] HTMLTag patch
Brought to you by:
derrickoswald
|
From: <tez...@ya...> - 2003-05-20 15:03:46
|
Hi, this is further to my Bug report via the SF site.
Basically, setParsed() wasn't effecting the actual
output of the Node thereafter. This made it a real
pain to highlight HTML, the example here being making
tables have a border of 1 to show them.
Patch attached. Has some debugging commented out,
you'll want to get rid of this. I put a patch for th
testing code on the sourceforge bug report.
Cheers,
Terry.
--------------------
*** HTMLTag.java 2003/05/20 12:33:42 1.1
--- HTMLTag.java 2003/05/20 14:52:42
***************
*** 273,283 ****
}
/**
* Sets the parsed.
! * @param parsed The parsed to set
*/
public void setParsed(Hashtable parsed) {
this.parsed = parsed;
}
/**
* Sets the strictTags.
* @param strictTags The strictTags to set
--- 273,306 ----
}
/**
* Sets the parsed.
! * Note: There is no guarantee that the attributes
will be:
! * in the same order or case as originally.
! * This isn't expected to be a problem, but
then again
! * it never is, is it?
! * Also: This currently makes no effort to place
the attribute
! * in quotes if necessary. You have to take
care of that
! * yourself
! * @param parsed The hash of (key,value) attribute
pairs to set
*/
public void setParsed(Hashtable parsed) {
this.parsed = parsed;
+
+ setText((String) parsed.get(this.TAGNAME)); //Set
the tag first
+ for(Enumeration e = parsed.keys();
e.hasMoreElements();) {
+ String temp = (String) e.nextElement();
+ if (!temp.equals(this.TAGNAME)) { //Don't add
the tagname again
+ append(" " + temp + '=' + ((String)
parsed.get(temp)));
+
+ //Debug
+ //System.out.println("setParsed appending key: "
+ temp + " to value: " + ((String) parsed.get(temp)));
+ }
+ }
+
+ //Debug
+ //System.out.println("setParsed: completed, now
text is:" + getText());
+
}
+
/**
* Sets the strictTags.
* @param strictTags The strictTags to set
=====
------------------------------------------------------------
Terry Alexis Lurie | 'Something witty that doesn't
Freelance Computer Engineer | look good with variable
United Kingdom | width fonts' - Most nerds
__________________________________________________
It's Samaritans' Week. Help Samaritans help others.
Call 08709 000032 to give or donate online now at http://www.samaritans.org/support/donations.shtm
|