| Returns true if the HTML given as a string parameter is empty.
This is needed to detect whether a field widget with HTMLArea rendering
actually contains entered text, either for validating of required parts
or for avoiding storing this "empty content". This method assumes the HTML is
cleaned up with the
org.outerj.daisy.frontend.editor.HtmlCleaningConvertor and that in case it is empty,
it only contains the html and body elements, with no extra attributes.
Given a specific configuration of the HtmlCleaningConvertor, we could detect
empty HTML simply by a string compare, but this method is a little bit more
robust to changing configurations (ie changes in amount of whitespace or
in the produced output of the html cleaner).
Practically speaking, it works as follows:
- If the input is null or an empty string, it is empty
- If the input text is longer then 50 characters, assume it is not empty.
- If the input contains <body/> or <body>...whitespace...</body> in it, it is empty
- else, it is not empty
|