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

Copyright | Copyright (C) 2011 Uwe Schmidt
License | MIT
Maintainer | Uwe Schmidt (uwe@fh-wedel.de)
Stability | stable
Portability | portable
Safe Haskell | None
Language | Haskell98

Text.XML.HXT.DOM.QualifiedName

Description

The types and functions for qualified names

Synopsis

- data QName
- data XName
- type NsEnv = AssocList XName XName
- mkQName :: String -> String -> String -> QName
- mkName :: String -> QName
- mkNsName :: String -> String -> QName
- mkSNsName :: String -> QName
- mkPrefixLocalPart :: String -> String -> QName
- equivQName :: QName -> QName -> Bool
- equivUri :: String -> String -> Bool
- equalQNameBy :: (String -> String -> Bool) -> QName -> QName -> Bool
- namePrefix :: QName -> String
- localPart :: QName -> String
- namespaceUri :: QName -> String
- newXName :: String -> XName
- nullXName :: XName
- isNullXName :: XName -> Bool
- newQName :: XName -> XName -> XName -> QName
- mkQName' :: XName -> XName -> XName -> QName
- namePrefix' :: QName -> XName
- localPart' :: QName -> XName
- namespaceUri' :: QName -> XName
- setNamePrefix' :: XName -> QName -> QName
- setLocalPart' :: XName -> QName -> QName
- setNamespaceUri' :: XName -> QName -> QName
- qualifiedName :: QName -> String
- qualifiedName' :: QName -> String -> String
- universalName :: QName -> String
- universalUri :: QName -> String
- buildUniversalName :: (String -> String -> String) -> QName -> String
- normalizeNsUri :: String -> String
- setNamespace :: NsEnv -> QName -> QName
- isNCName :: String -> Bool
- isWellformedQualifiedName :: String -> Bool
- isWellformedQName :: QName -> Bool
- isWellformedNSDecl :: QName -> Bool
- isWellformedNameSpaceName :: QName -> Bool
- isNameSpaceName :: QName -> Bool
- isDeclaredNamespace :: QName -> Bool
- xmlNamespaceXName :: XName
- xmlXName :: XName
- xmlnsNamespaceXName :: XName
- xmlnsXName :: XName
- xmlnsQN :: QName
- toNsEnv :: AssocList String String -> NsEnv

# Documentation

data QName Source

Namespace support for element and attribute names.

A qualified name consists of a name prefix, a local name and a namespace uri. All modules, which are not namespace aware, use only the `localPart` component. When dealing with namespaces, the document tree must be processed by `propagateNamespaces` to split names of structure "prefix:localPart" and label the name with the apropriate namespace uri

Instances

Eq QName Source | Two QNames are equal if (1. case) namespaces are both empty and the qualified names (prefix:localpart) are the same or (2. case) namespaces are set and namespaces and local parts are equal
Ord QName Source |
Show QName Source |
Binary QName Source |
NFData QName Source |
WNFData QName Source |

data XName Source

XML names are represented by Strings, but these strings do not mix up with normal strings. Names are always reduced to normal form, and they are stored internally in a name cache for sharing equal names by the same data structure

Instances

Eq XName Source |
Ord XName Source |
Binary XName Source |
NFData XName Source |
WNFData XName Source |

type NsEnv = AssocList XName XName Source

Type for the namespace association list, used when propagating namespaces by modifying the `QName` values in a tree

mkQName :: String -> String -> String -> QName Source

constructs a complete qualified name with `namePrefix`, `localPart` and `namespaceUri`. This function can be used to build not wellformed prefix:localpart names. The XPath module uses wildcard names like `xxx:*`. These must be build with `mkQName` and not with mkName.

mkName :: String -> QName Source

constructs a simple, namespace unaware name. If the name is in `prefix:localpart` form and the prefix is not empty the name is split internally into a prefix and a local part.

mkNsName :: String -> String -> QName Source

constructs a simple, namespace aware name, with prefix:localPart as first parameter, namspace uri as second.

see also `mkName`, `mkPrefixLocalPart`

mkSNsName :: String -> QName Source

Deprecated: use mkName instead

old name for `mkName`

mkPrefixLocalPart :: String -> String -> QName Source

constructs a simple name, with prefix and localPart but without a namespace uri.

see also `mkQName`, `mkName`

equivQName :: QName -> QName -> Bool Source

Equivalent QNames are defined as follows: The URIs are normalized before comparison. Comparison is done with `equalQNameBy` and `equivUri`

equivUri :: String -> String -> Bool Source

Comparison of normalized namespace URIs using `normalizeNsUri`

equalQNameBy :: (String -> String -> Bool) -> QName -> QName -> Bool Source

Sometimes a weaker equality relation than `equalQName` is appropriate, e.g no case significance in names, ... a name normalization function can be applied to the strings before comparing. Called by `equalQName` and `equivQName`

namePrefix :: QName -> String Source

localPart :: QName -> String Source

namespaceUri :: QName -> String Source

newXName :: String -> XName Source

nullXName :: XName Source

isNullXName :: XName -> Bool Source

newQName :: XName -> XName -> XName -> QName Source

mkQName' :: XName -> XName -> XName -> QName Source

Deprecated: use newQName instead with lp px ns param seq

namePrefix' :: QName -> XName Source

localPart' :: QName -> XName Source

namespaceUri' :: QName -> XName Source

setNamePrefix' :: XName -> QName -> QName Source

set name prefix

setLocalPart' :: XName -> QName -> QName Source

set local part

setNamespaceUri' :: XName -> QName -> QName Source

set name prefix

qualifiedName :: QName -> String Source

builds the full name "prefix:localPart", if prefix is not null, else the local part is the result

qualifiedName' :: QName -> String -> String Source

functional list version of qualifiedName used in xshow

universalName :: QName -> String Source

builds the "universal" name, that is the namespace uri surrounded with "{" and "}" followed by the local part (specialisation of `buildUniversalName`)

universalUri :: QName -> String Source

builds an "universal" uri, that is the namespace uri followed by the local part. This is usefull for RDF applications, where the subject, predicate and object often are concatenated from namespace uri and local part (specialisation of `buildUniversalName`)

buildUniversalName :: (String -> String -> String) -> QName -> String Source

builds a string from the namespace uri and the local part. If the namespace uri is empty, the local part is returned, else namespace uri and local part are combined with the combining function given by the first parameter

normalizeNsUri :: String -> String Source

Normalization of URIs: Normalization is done by conversion into lowercase letters. A trailing "/" is ignored

setNamespace :: NsEnv -> QName -> QName Source

Compute the name prefix and the namespace uri for a qualified name.

This function does not test whether the name is a wellformed qualified name. see Namespaces in XML Rule [6] to [8]. Error checking is done with separate functions, see `isWellformedQName` and `isWellformedQualifiedName` for error checking.

isNCName :: String -> Bool Source

test for wellformed NCName, rule [4] XML Namespaces

isWellformedQualifiedName :: String -> Bool Source

test for wellformed QName, rule [6] XML Namespaces predicate is used in filter `valdateNamespaces`.

isWellformedQName :: QName -> Bool Source

test for wellformed QName values. A QName is wellformed, if the local part is a NCName, the namePrefix, if not empty, is also a NCName. predicate is used in filter `valdateNamespaces`.

isWellformedNSDecl :: QName -> Bool Source

test whether an attribute name is a namesapce declaration name. If this is not the case True is the result, else the name must be a well formed namespace name: All namespace prefixes starting with "xml" are reserved for XML related definitions. predicate is used in filter `valdateNamespaces`.

isWellformedNameSpaceName :: QName -> Bool Source

test for a namespace name to be well formed

isNameSpaceName :: QName -> Bool Source

test whether a name is a namespace declaration attribute name

isDeclaredNamespace :: QName -> Bool Source

predicate is used in filter `valdateNamespaces`.

xmlNamespaceXName :: XName Source

xmlXName :: XName Source

xmlnsNamespaceXName :: XName Source

xmlnsXName :: XName Source

xmlnsQN :: QName Source

toNsEnv :: AssocList String String -> NsEnv Source