Namespace filter
Namespaces are processed with two main filter, propagateNamespaces
and validateNamespaces
.
propagateNamespaces
takes a XML tree and
attaches extra namespace info at every tag name and attribute name.
So after processing a tree with propagateNamespaces
, the access functions
namespaceOf and universalNameOf deliver the associated namespace (or "")
for tag names and attribute names.
validateNamespaces
checks whether names are wellformed related to the XML namespace definition.
whether a legal namespace is declared for all prefixes, and whether attribute names are unique
related to universal names.
Documentation
type NamespaceTable = NsEnvSource
Type for the namespace association list, used when propagating namespaces by
modifying the QName
values in a tree
propagateNamespaces :: XmlFilterSource
propagate all namespace declarations "xmlns:ns=..." to all tag and attribute nodes of a document.
This filter does not check for illegal use of namespaces.
The real work is done by propagateNamespaceEnv
.
The filter may be applied repeatedly if neccessary.
propagateNamespaceEnv :: NamespaceTable -> XmlFilterSource
attaches the namespace info given by the namespace table to a tag node and its attributes and children.
validateNamespaces :: XmlFilterSource
validate the namespace constraints in a whole tree.
result is the list of errors concerning namespaces.
Work is done by applying validate1Namespaces
to all nodes.
Predicates isWellformedQName
, isWellformedQualifiedName
, isDeclaredNamespace
and isWellformedNSDecl
are applied to the appropriate tags and attributes.
validate1Namespaces :: XmlFilterSource
a single node for namespace constrains.