This package converts from OutputForm, which is a hierarchical tree structure, to html which uses tags arranged in a hierarchical tree structure. So the package converts from one tree (graph) structure to another.
This conversion is done in two stages using an intermediate Tree String structure. This Tree String structure represents HTML where:
- leafs represents unstructured text
- string in leafs contains the text
- non-leafs represents xml elements
- string in non-leafs represents xml attributes
This is created by traversing OutputForm while building up the Tree String structure.
The second stage is to convert the Tree Structure to text. All text output is done using:
I have not produced and output to String as I don't know a way to append to a long string efficiently and I don't know how to insert carriage-returns into a String.
There would be some benefits in creating a XMLFormat category which would contain common elements for all xml formatted outputs such as HTMLFormat, MathMLFormat, SVGFormat and X3DFormat. However programming effort might be better spent creating a version of OutputForm which has better syntax information.