AO Fluent HTML

project: alphamanagement: previewpackaging: developmental
java: >= 8semantic versioning: 2.0.0license: LGPL v3

Fluent Java DSL for high-performance HTML generation.

Modules

Motivation

We have a lot of legacy servlet-based code that directly writes HTML as strings. This technique is both tedious and error-prone. We've been refactoring code to support HTML 5, and now is a good time to clean this up without radically rewriting everything.

Features

  • Supports HTML 4.01, XHTML 1.0, HTML 5 and XHTML 5.
  • Supports both SGML and XML serializations.
  • Fluent API.
  • Integrates with AO in-context translation tools.
  • Streaming implementation, including attributes.
  • Stupid fast (TODO: benchmark).
  • Separate module for use in a Servlet environment.

Limitations

Not all tags and attributes are implemented. We are implementing as we go. A full implementation of all tags and attributes would probably be best achieved with code generation. This project will remain below version 1.0.0 until it has a reasonably complete implementation.

Evaluated Alternatives

HtmlFlow

HtmlFlow is a Java DSL to write typesafe HTML documents in a fluent style. It is very close to what we want. We may look into integrating our unique needs with their implementation. At this time, however, we still required support for XHTML 1.0, HTML 4, and XHTML 5. This, along with interoperability with our other projects, is steering us toward our own implementation.