Next / Previous / Contents / Shipman's homepage

4.4. Global declarations

Because Python does not have constants per se, we use a naming convention: the names of constants use all capital letters, with “_” as the word separator.

# - - - - -   M a n i f e s t   c o n s t a n t s

4.4.1. DB5_NS

The DocBook 5.0 namespace URI.

DB5_NS = ''

4.4.2. nsWrap: Namespace-wrap function

This function combines a namespace URI and a local name to return a fully qualified name. This notation was invented by James Clark: the namespace Uniform Resource Identifier is wrapped in “{...}”, folowed by the local name.

def nsWrap(ns, local):
    '''Combine an NSURI and a local name.
    return '{{{0}}}{1}'.format(ns, local)

4.4.3. dbWrap(): Wrap a DocBook name

Given a DocBook 5 local name, returns the fully qualified name.

def dbWrap(local):
    '''Convert a DocBook 5 name to a QName.
    return nsWrap(DB5_NS, local)

4.4.4. PROG_ELT

Name of the programlisting element, which is in the DocBook namespace.

PROG_ELT = dbWrap('programlisting')

4.4.5. ROLE_ATTR

Name of the role attribute.

ROLE_ATTR = 'role'


The initial part of the role attribute that identifies the destination file.

ROLE_PREFIX = "outFile:"