TextFilter Project - Home

TextFilter is a Java library that performs nested filtering and transformations on arbitrary textual data.

The original impetus for developing the library was to provide safe HTML filtering for the IWETHEY Forums; posters are not allowed to include such things as Javascript or iframes in their post for security reasons. However, the TextFilter library is capable of much more.

TextFilter allows arbitrary text "handlers" that are used to parse, transform, and/or block the text triggering the invocation of each handler. Handlers are grouped in "filters", and are stackable within the context of a filter parsing call. Filters may also be stacked within the call, allowing nested behavior.

TextFilter comes with a set of standard low-level handlers, such as HTML escaping and constant tags, as well as a number of complex nesting HTML tag handlers, such as <table> and <ol> handlers. There are also some special-purpose handlers that can, for example, create links to Google searches and the like.

TextFilter originated as a Python rewrite of a Perl programming example. The resulting code, written by Scott Anderson, was used in the Zope prototype of the IWETHEY Forums. Subsequently, this code was ported by Scott to ObjectiveC and finally Java, gaining features along the way.