Next are imported modules.
# - - - - - I m p o r t s
The standard Python regular expression module.
import re
We use a number of utility functions from Section 11, “The abbr.py module”. To avoid collision with variables named
abbr, we import it as abbrMod.
import abbr as abbrMod
The lxml.etree
package handles XML parsing; see Python XML processing with lxml. We also use the etbuilder.py module from that document for
functions such as Section 6.11, “Txny.abbrHtmlSubelt()”,
so we get the et module from there (same as lxml.etree), plus the E() constructor
and also the CLASS() helper function.
# - - - - - I m p o r t s from etbuilder import et, E, CLASS, addText
File rnc_txny.py contains symbolic
constants for all the XML element and attribute names used
in the schema. It is created automatically from the
schema: see pyrang: A
single-sourcing tool for Python-XML applications.
import rnc_txny as rnc
We use the rnc_validate.py module to validate the XML file
against the txny.rng schema. This module is part of the pylxml package.
import rnc_validate