hxt-9.3.1.16: A collection of tools for processing XML with Haskell.

Text.XML.HXT.Arrow.Namespace

Description

namespace specific arrows

Synopsis

# Documentation

attach all valid namespace declarations to the attribute list of element nodes.

This arrow is useful for document processing, that requires access to all namespace declarations at any element node, but which cannot be done with a simple processWithNsEnv.

does the real work for namespace cleanup.

The parameter is used for collecting namespace uris and prefixes from the input tree

collect all namespace declarations contained in a document

apply getNamespaceDecl to a whole XmlTree

collect all (namePrefix, namespaceUri) pairs from a tree

all qualified names are inspected, whether a namespace uri is defined, for these uris the prefix and uri is returned. This arrow is useful for namespace cleanup, e.g. for documents generated with XSLT. It can be used together with collectNamespaceDecl to cleanupNamespaces

test whether an attribute node contains an XML Namespace declaration

get the namespace prefix and the namespace URI out of an attribute tree with a namespace declaration (see isNamespaceDeclAttr) for all other nodes this arrow fails

processWithNsEnv :: ArrowXml a => (NsEnv -> a XmlTree XmlTree) -> NsEnv -> a XmlTree XmlTree Source #

process a document tree with an arrow, containing always the valid namespace environment as extra parameter.

The namespace environment is implemented as a AssocList

process all element nodes of a document tree with an arrow, containing always the valid namespace environment as extra parameter. Attribute lists are not processed.

See also: processWithNsEnv

propagate all namespace declarations "xmlns:ns=..." to all element and attribute nodes of a document.

This arrow does not check for illegal use of namespaces. The real work is done by propagateNamespaceEnv.

The arrow may be applied repeatedly if neccessary.

generate unique namespaces and add all namespace declarations to all top nodes containing a namespace declaration Usually the top node containing namespace declarations is the root node, but this isn't mandatory.

Calls cleanupNamespaces with collectNamespaceDecl

generate unique namespaces and add all namespace declarations for all prefix-uri pairs in all qualified names

useful for cleanup of namespaces in generated documents. Calls cleanupNamespaces with  collectNamespaceDecl <+> collectPrefixUriPairs

validate the namespace constraints in a whole tree.

Result is the list of errors concerning namespaces. Predicates isWellformedQName, isWellformedQualifiedName, isDeclaredNamespace and isWellformedNSDecl are applied to the appropriate elements and attributes.