What Is HTE?
HTE (HTML Treebuilder Engine) provides an easy way to programatically build HTML document trees.
How Does HTE Work?
HTE provides an Html Tree object which is used to generate and manage nodes on the HTML document tree. Nodes may be:
- tag elements
- text strings
- raw strings
- an arbitrary object supporting the
To create tag elements, use the tree object and a method name matching the tag. E.g.,
to produce (pretty printed):
Closing tags are handled according to the various specs (HTML5, XHTML, XML) as are attribute names and quoting.
Text strings are first class nodes but have no children and are appropriately escaped. Raw strings are first class nodes but have no children and are not escaped.
A tree may be rendered at any time to produce an ordered flat list of nodes. The most common output operation will be to generate a string to produce a complete or partial HTML document.
The code is intentionally minimal. HTE is meant to be lean and lightweight.
There is currently no support for validating the nodes of the tree with respect to attributes, hierarchical relationships, or required elements of a fully compliant HTML page.
To tabulate all environment variables:
For more Tree Builder Examples.
- No labels