Re: [Htmlparser-user] Recreating HTML
Brought to you by:
derrickoswald
|
From: Somik R. <so...@ya...> - 2002-08-07 04:13:37
|
Hi Dhaval,
I would like to know the purpose of the toHTML() function in HTMLTag
class. Is this function supposed to output the parsed tag as parsed by
the HTMLParser or am I supposed to override this function in my custom
tag class to depict theHTML formed if any of the attributes of the tag
have been changed.=20
This method is supposed to give you a reconstruction of the HTML Tag =
parsed. Even if the tag parsed was malformed, the result of this method =
will be correct HTML.
In short I woudl like to know whether I need to
override this method since at present I can only see the original parsed
data in it and not my modified data.
Thats right - for your application - you will need to change the =
functionality of this method.
I've been thinking of introducing HTMLRenderers, for a tag - so you can =
dynamically change it for the tags that you want. That would be a =
cleaner solution - so you might have an interface
public interface HTMLRenderer {
public String toHTML() {
}
}
and for your input tag, you should have a static method
public static void addHTMLRenderer(HTMLRenderer renderer) {
}
Then, HTMLInputTag.toHTML() may have an implementation -=20
public String toHTML() {
if (renderer!=3Dnull) return renderer.toHTML(); else=20
return super.toHTML();
}
This way, we can have both the normal functionality, and the modified =
functionality.
Regards,
Somik
|