Tutorials‎ > ‎

XHTML Output

Creating Output in XHTML Format

Generating output from pDynamo programs in XHTML format, instead of plain text, is straightforward. An example, Example10XHTML.py, is given in the examples directory of the pDynamo distribution. The essential differences between this example and its equivalent plain text version, Example10.py, are:

  1. Define an instance of the XHTMLLogFileWriter class before any output occurs. A suitable command is: logFile = XHTMLLogFileWriter ( title = "Some text." ). The title keyword argument defines the title to be used in the header section of the XHTML page.
  2. Optionally write out a header at the top of the page using logFile.Header ( "Some text." ).
  3. Include the keyword argument log = logFile in all subsequent calls of functions and methods that produce output. E.g. molecule.Energy ( log = logFile ).
  4. Terminate output to the page with the statement logFile.Footer ( ). This method call is essential, in contrast to the use of Header which is optional.