hxt-7.5: A collection of tools for processing XML with Haskell.ContentsIndex
Text.XML.HXT.Arrow.Namespace
Portabilityportable
Stabilityexperimental
MaintainerUwe Schmidt (uwe@fh-wedel.de)
Description

Version : $Id: Namespace.hs,v 1.13 20061112 14:52:59 hxml Exp $

namespace specific arrows

Synopsis
attachNsEnv :: ArrowXml a => NsEnv -> a XmlTree XmlTree
cleanupNamespaces :: LA XmlTree (String, String) -> LA XmlTree XmlTree
collectNamespaceDecl :: LA XmlTree (String, String)
collectPrefixUriPairs :: LA XmlTree (String, String)
isNamespaceDeclAttr :: ArrowXml a => a XmlTree XmlTree
getNamespaceDecl :: ArrowXml a => a XmlTree (String, String)
processWithNsEnv :: ArrowXml a => (NsEnv -> a XmlTree XmlTree) -> NsEnv -> a XmlTree XmlTree
processWithNsEnvWithoutAttrl :: ArrowXml a => (NsEnv -> a XmlTree XmlTree) -> NsEnv -> a XmlTree XmlTree
propagateNamespaces :: ArrowXml a => a XmlTree XmlTree
uniqueNamespaces :: ArrowXml a => a XmlTree XmlTree
uniqueNamespacesFromDeclAndQNames :: ArrowXml a => a XmlTree XmlTree
validateNamespaces :: ArrowXml a => a XmlTree XmlTree
Documentation
attachNsEnv :: ArrowXml a => NsEnv -> a XmlTree XmlTree

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.

cleanupNamespaces :: LA XmlTree (String, String) -> LA XmlTree XmlTree

does the real work for namespace cleanup.

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

collectNamespaceDecl :: LA XmlTree (String, String)

collect all namespace declarations contained in a document

apply getNamespaceDecl to a whole XmlTree

collectPrefixUriPairs :: LA XmlTree (String, String)

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

isNamespaceDeclAttr :: ArrowXml a => a XmlTree XmlTree
test whether an attribute node contains an XML Namespace declaration
getNamespaceDecl :: ArrowXml a => a XmlTree (String, String)
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

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

The namespace environment is implemented as a Data.AssocList.AssocList

processWithNsEnvWithoutAttrl :: ArrowXml a => (NsEnv -> a XmlTree XmlTree) -> NsEnv -> a XmlTree XmlTree

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

propagateNamespaces :: ArrowXml a => a XmlTree XmlTree

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.

uniqueNamespaces :: ArrowXml a => a XmlTree XmlTree

generate unique namespaces and add all namespace declarations to the root element

Calls cleanupNamespaces with collectNamespaceDecl

uniqueNamespacesFromDeclAndQNames :: ArrowXml a => a XmlTree XmlTree

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

validateNamespaces :: ArrowXml a => a XmlTree XmlTree

validate the namespace constraints in a whole tree.

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

Produced by Haddock version 2.1.0