Next / Previous / Contents / Shipman's homepage

42. soxtest: Test driver

This script exercises the various functions of the module.

soxtest
#!/usr/bin/env python
#================================================================
# soxtest: Test driver for sox.py
#
# Do not edit this file directly.  It is extracted automatically
# from the documentation:
#    http://www.nmt.edu/~shipman/soft/sox/
#----------------------------------------------------------------

import sys
import sox

HTML_PUB_ID = "-//W3C//DTD XHTML 1.1//EN"
HTML_SYS_ID = "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"

# - - - - -   m a i n

def main():
    '''Main program.
    '''
    s = sox.Sox(sys.stdout)
    s.doctype("html", HTML_PUB_ID, HTML_SYS_ID)
    html = s.start("html")
    head = s.start("head")
    s.leaf("title", "Page title here")
    head.end()
    body = s.start("body")
    s.leaf("h1", "Main title here")
    s.leaf("hr")
    s.leaf("p", {'class': 'note'}, "Some text",
            " and some more text", id='p001')
    body.end()
    html.end()

# - - - - -   E p i l o g u e

if __name__ == '__main__':
    main()