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

CopyrightCopyright (C) 2005-2008 Uwe Schmidt
LicenseMIT
MaintainerUwe Schmidt (uwe@fh-wedel.de)
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell98

Text.XML.HXT.Arrow.Namespace

Description

namespace specific arrows

Synopsis

Documentation

attachNsEnv :: ArrowXml a => NsEnv -> a XmlTree XmlTree Source #

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 Source #

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) Source #

collect all namespace declarations contained in a document

apply getNamespaceDecl to a whole XmlTree

collectPrefixUriPairs :: LA XmlTree (String, String) Source #

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 Source #

test whether an attribute node contains an XML Namespace declaration

getNamespaceDecl :: ArrowXml a => a XmlTree (String, String) Source #

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

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

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 Source #

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 Source #

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

uniqueNamespacesFromDeclAndQNames :: ArrowXml a => a XmlTree XmlTree Source #

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 Source #

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.