A user account is required in order to edit this wiki, but we've had to disable public user registrations due to spam.

To request an account, ask an autoconfirmed user on Chat (such as one of these permanent autoconfirmed members).

Validator.nu Templates: Difference between revisions

From WHATWG Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
{{Obsolete|spec=https://github.com/validator/validator/wiki/Templates}}
{{Obsolete|spec=https://github.com/validator/validator/wiki/Service:-Frontend:-HTML}}
The HTML and XHTML outputs of Validator.nu 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.
The HTML and XHTML outputs of Validator.nu 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.



Revision as of 01:14, 22 March 2015

This document is obsolete.

For the current specification, see: https://github.com/validator/validator/wiki/Service:-Frontend:-HTML

The HTML and XHTML outputs of Validator.nu 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, which was written to aid the development of Validator.nu.

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.