hxt-8.1.0: A collection of tools for processing XML with Haskell.Source codeContentsIndex
Text.XML.HXT.XPath.XPathDataTypes
Portabilityportable
Stabilityexperimental
MaintainerUwe Schmidt (uwe@fh-wedel.de)
Description
The core data types of XPath. The Type NodeSet is based on the module NavTree which was adapted from HXML (http://www.flightlab.com/~joe/hxml/)
Synopsis
data Expr
= GenExpr Op [Expr]
| PathExpr (Maybe Expr) (Maybe LocationPath)
| FilterExpr [Expr]
| VarExpr VarName
| LiteralExpr Literal
| NumberExpr XPNumber
| FctExpr FctName FctArguments
data Op
= Or
| And
| Eq
| NEq
| Less
| Greater
| LessEq
| GreaterEq
| Plus
| Minus
| Div
| Mod
| Mult
| Unary
| Union
data XPNumber
= Float Float
| NaN
| NegInf
| Neg0
| Pos0
| PosInf
data LocationPath = LocPath Path [XStep]
data Path
= Rel
| Abs
data XStep = Step AxisSpec NodeTest [Expr]
data AxisSpec
= Ancestor
| AncestorOrSelf
| Attribute
| Child
| Descendant
| DescendantOrSelf
| Following
| FollowingSibling
| Namespace
| Parent
| Preceding
| PrecedingSibling
| Self
data NodeTest
= NameTest QName
| PI String
| TypeTest XPathNode
data XPathNode
= XPNode
| XPCommentNode
| XPPINode
| XPTextNode
type Name = (NamePrefix, LocalName)
type NamePrefix = String
type LocalName = String
type VarName = Name
type Literal = String
type FctName = String
type FctArguments = [Expr]
type Context = (ConPos, ConLen, ConNode)
type ConPos = Int
type ConLen = Int
type ConNode = NavXmlTree
data XPathValue
= XPVNode NodeSet
| XPVBool Bool
| XPVNumber XPNumber
| XPVString String
| XPVError String
type NavXmlTree = NavTree XNode
type NavXmlTrees = [NavXmlTree]
type NodeSet = NavXmlTrees
type XPathFilter = XPathValue -> XPathValue
type VarTab = [(VarName, XPathValue)]
type KeyTab = [(QName, String, NavXmlTree)]
type Env = (VarTab, KeyTab)
varEnv :: Env
module Text.XML.HXT.XPath.NavTree
Documentation
data Expr Source
Represents expression
Constructors
GenExpr Op [Expr]generic expression with an operator and one or more operands
PathExpr (Maybe Expr) (Maybe LocationPath)a path expression contains an optional filter-expression or an optional locationpath. one expression is urgently necessary, both are possible
FilterExpr [Expr]filter-expression with zero or more predicates
VarExpr VarNamevariable
LiteralExpr Literalstring
NumberExpr XPNumbernumber
FctExpr FctName FctArgumentsa function with a name and an optional list of arguments
show/hide Instances
data Op Source
Represents XPath operators
Constructors
Or
And
Eq
NEq
Less
Greater
LessEq
GreaterEq
Plus
Minus
Div
Mod
Mult
Unary
Union
show/hide Instances
data XPNumber Source

Represents a floating-point number according the IEEE 754 standard

The standard includes a special Not-a-Number (NaN) value, positive and negative infinity, positive and negative zero.

Constructors
Float Floatfloating-point number
NaNnot-a-number
NegInfnegative infinity
Neg0negative zero
Pos0positive zero
PosInfpositive infinity
show/hide Instances
data LocationPath Source

Represents location path

A location path consists of a sequence of one or more location steps.

Constructors
LocPath Path [XStep]
show/hide Instances
data Path Source
A location path is either a relative or an absolute path.
Constructors
Rel
Abs
show/hide Instances
data XStep Source

Represents location step

A location step consists of an axis, a node-test and zero or more predicates.

Constructors
Step AxisSpec NodeTest [Expr]
show/hide Instances
data AxisSpec Source
Represents XPath axis
Constructors
Ancestor
AncestorOrSelf
Attribute
Child
Descendant
DescendantOrSelf
Following
FollowingSibling
Namespace
Parent
Preceding
PrecedingSibling
Self
show/hide Instances
data NodeTest Source
Represents XPath node-tests
Constructors
NameTest QNamename-test
PI Stringprocessing-instruction-test with a literal argument
TypeTest XPathNodeall nodetype-tests
show/hide Instances
data XPathNode Source
Represents nodetype-tests
Constructors
XPNodeall 7 nodetypes (root, element, attribute, namespace, pi, comment, text)
XPCommentNodecomment-nodes
XPPINodeprocessing-instruction-nodes
XPTextNodetext-nodes: cdata, character data
show/hide Instances
type Name = (NamePrefix, LocalName)Source
type NamePrefix = StringSource
type LocalName = StringSource
type VarName = NameSource
Variable name
type Literal = StringSource
a string
type FctName = StringSource
Function name
type FctArguments = [Expr]Source
Function arguments
type Context = (ConPos, ConLen, ConNode)Source
Evaluation context
type ConPos = IntSource
Context position
type ConLen = IntSource
Context length
type ConNode = NavXmlTreeSource
Context node
data XPathValue Source
Represents XPath results
Constructors
XPVNode NodeSetnode-set
XPVBool Boolboolean value
XPVNumber XPNumbernumber according the IEEE 754 standard
XPVString Stringstring value
XPVError Stringerror message with text
show/hide Instances
type NavXmlTree = NavTree XNodeSource
Node of navigable tree representation
type NavXmlTrees = [NavXmlTree]Source
List of nodes of navigable tree representation
type NodeSet = NavXmlTreesSource
Type synonym for a list of navigable tree representation
type XPathFilter = XPathValue -> XPathValueSource
A functions that takes a XPath result and returns a XPath result
type VarTab = [(VarName, XPathValue)]Source

XPath environment

All variables are stored in the environment, each variable name is bound to a value.

type KeyTab = [(QName, String, NavXmlTree)]Source
type Env = (VarTab, KeyTab)Source
varEnv :: EnvSource
module Text.XML.HXT.XPath.NavTree
Produced by Haddock version 2.3.0