qualify splits a Name of the form pr:nm into the
prefix pr and local name nm, and looks up the prefix in the
given environment to determine its Namespace. There may also be a
default namespace (the first argument) for unqualified names.
In the absence of a default Namespace, a Name that does not have
a prefix remains unqualified. A prefix that is not known in the
environment becomes a fresh namespace with null URI. A Name that is
already qualified is passed unchanged, unless its URI was null, in
which case we check afresh for that prefix in the environment.

qualifyExceptLocal converts names to qualified names, except where
an existing qualification matches the default namespace, in which case
the qualification is removed. (This is useful when translating QNames
to Haskell, because Haskell qualified names cannot use the current
module name.)

resolveAllNames in a document, causes every name to be properly
qualified with its namespace. There is a default namespace for any
name that was originally unqualified. This is likely only useful when
dealing with parsed document, less useful when generating a document
from scratch.