The HTML and XHTML outputs of the checker are produced using SAX
serializers. When variable content is pushed to the serializers, SAX
events are emitted from hand-written Java code. However, for static
boilerplate parts, generated code is used.

It is particularly noteworthy that for (X)HTML, the `MessageEmitter`
subclass generates a document fragment that appears inside a larger
document but for the other output formats, the entire response is
generated by the `MessageEmitter` subclass. This design is mainly due to
the legacy of controller code evolution from an initial interactive
HTML-only design to cover non-interactive Web service response formats
later.

## The Generator Tool

The generated code is produced from XML file using
[SaxCompiler](https://hsivonen.fi/saxcompiler/), which was written to
aid the development of the checker.

SaxCompiler turns an XML document into a Java class with a re-entrant
static method for replaying the SAX events of the XML document. The
events for the document and root element start/end can optionally be
omitted.

Callbacks to an object passed as an argument to the static method are
possible and used for running code that emits the variable part of the
result document.

## The Generated Emitters

### `PageEmitter`

This emitter generates the `html`, `head`, `body`, `title`, `h1`, `hr`
and `p` (after `hr`) elements. The contents of each one involves a
callback to the controller.

### `FormEmitter`

This emitter generates the contents of the `form` element (but not the
element itself which is generated using hand-written code due to
variability in its attributes) in the generic facet.

### `Html5FormEmitter`

This emitter generates the contents of the `form` element (but not the
element itself which is generated using hand-written code due to
variability in its attributes) in the HTML5 facet.

### `CharsetEmitter`

Emits the table row containing the character encoding override UI
widget.

### `NsFilterEmitter`

Emits the table row containing the namespace filter UI widget.

### `StatsEmitter`

Emits the execution time statistics paragraph.

## Callbacks

In general, all package-private methods on the controller classes
(`VerifierServletTransaction` and `Html5ConformanceCheckerTransaction`)
are callbacks of some kind.

