|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.arsdigita.bebop.parameters.TidyHTMLValidationListener
Verifies that the parameter's value is well-formed HTML by running it through JTidy.
Side effect: Tidy
may raise errors and warnings. If
errors are found, then the input HTML is broken in a way that Tidy cannot
repair. If only warnings are found, Tidy will clean up the HTML. This
validation listener will replace the original data with the tidied
up version.(But only if the repair policy
is set accordingly.) The user will be
given a chance to examine and accept the changes that Tidy made. Note that
only markup is changed. The actual text will not be lost as a result of
replacement.
This validation listener will not pass until Tidy is satisfied with the user's HTML.
Issues: JTidy came to life a as port of Dave Ragget's HTML tidy C utility. As a result of
its C heritage, JTidy doesn't use Java's built-in support for different
character encodings. Rather than operating on Strings
or
writers
and readers
for working
with character data, JTidy works directly with input
/output
streams. The resulting support for
character encodings is limited to "ascii", "latin1", "raw", "utf8",
"iso2022", and "mac". (See the quickref
document distributed by the tidy project for an explanation of
these encoding schemes. Although not necessarily directly applicable to
JTidy, it provides a good overview.)
The bottom line is, JTidy does not behave like a "native" Java application when it comes to supporting character encodings. However, it is probably the most robust and widely used HTML validator written in Java. Therefore, we are providing a validation listener based on JTidy.
Field Summary |
Fields inherited from interface com.arsdigita.bebop.event.ParameterListener |
versionId |
Constructor Summary | |
TidyHTMLValidationListener()
|
Method Summary | |
boolean |
repairsOriginalData()
|
void |
setRepairPolicy(boolean repairOriginalData)
Specifies whether the original form data should be replaced with the tidied up version, if it fails to validate against JTidy. |
void |
validate(ParameterEvent e)
Performs a validation check on the data objects associated with a specific parameter. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TidyHTMLValidationListener()
Method Detail |
public void setRepairPolicy(boolean repairOriginalData)
repairsOriginalData()
public boolean repairsOriginalData()
true
, unless modified via setRepairPolicy(boolean)
.setRepairPolicy(boolean)
public void validate(ParameterEvent e)
ParameterListener
validate
in interface ParameterListener
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |