Re: [Htmlparser-developer] HTMLTag patch
Brought to you by:
derrickoswald
From: Somik R. <so...@ya...> - 2003-05-21 23:44:19
|
You should not be using setParsed. Instead, all you have to do is use setAttribute on TableTag, like so: tableTag.setAttribute("BORDER",1); Then, make a call to tableTag.toHtml(), and it should show up. Regards, Somik ----- Original Message ----- From: "Terry Alexis Lurie" <tez...@ya...> To: <htm...@li...> Sent: Wednesday, May 21, 2003 5:10 AM Subject: Re: [Htmlparser-developer] HTMLTag patch > Yes, I'd like to be able to programmatically set > certain attributes. Its for a highlighted step-by-step > through a web-rip, so the focus table is border=1 or > whatever [very uncommon these days], the rest is as > is. > > I've been doing this in Perl's HTML::Parse for a > while, but now shifting to Java because of work. > > Terry. > > --- Somik Raha <so...@ya...> wrote: > Hi Terry > > Just curious - why do you need to call > > setParsed() ? > > Are you trying to take all tables and ensure > > that they have a border "1" > > ? > > > > Regards, > > Somik > > ----- Original Message ----- > > From: "Terry Alexis Lurie" <tez...@ya...> > > To: <htm...@li...> > > Sent: Tuesday, May 20, 2003 11:03 AM > > Subject: [Htmlparser-developer] HTMLTag patch > > > > > > > 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 > > > > > > > > > > > > ------------------------------------------------------- > > > This SF.net email is sponsored by: ObjectStore. > > > If flattening out C++ or Java code to make your > > application fit in a > > > relational database is painful, don't do it! Check > > out ObjectStore. > > > Now part of Progress Software. > > http://www.objectstore.net/sourceforge > > > _______________________________________________ > > > Htmlparser-developer mailing list > > > Htm...@li... > > > > > > https://lists.sourceforge.net/lists/listinfo/htmlparser-developer > > > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: ObjectStore. > > If flattening out C++ or Java code to make your > > application fit in a > > relational database is painful, don't do it! Check > > out ObjectStore. > > Now part of Progress Software. > > http://www.objectstore.net/sourceforge > > _______________________________________________ > > Htmlparser-developer mailing list > > Htm...@li... > > > https://lists.sourceforge.net/lists/listinfo/htmlparser-developer > > ===== > ------------------------------------------------------------ > 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 > > > ------------------------------------------------------- > This SF.net email is sponsored by: ObjectStore. > If flattening out C++ or Java code to make your application fit in a > relational database is painful, don't do it! Check out ObjectStore. > Now part of Progress Software. http://www.objectstore.net/sourceforge > _______________________________________________ > Htmlparser-developer mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/htmlparser-developer |