org.outerj.daisy.frontend
Class HtmlHelper

java.lang.Object
  extended by org.outerj.daisy.frontend.HtmlHelper

public class HtmlHelper
extends java.lang.Object


Constructor Summary
HtmlHelper()
           
 
Method Summary
static boolean isEmpty(java.lang.String html)
          Returns true if the HTML given as a string parameter is empty.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HtmlHelper

public HtmlHelper()
Method Detail

isEmpty

public static boolean isEmpty(java.lang.String html)
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 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:



Copyright © -2006 . All Rights Reserved.