Next / Previous / Contents / Shipman's homepage

4. Imported modules

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 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 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 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 module to validate the XML file against the txny.rng schema. This module is part of the pylxml package.
import rnc_validate