hxt-xpath-9.1.2.2: The XPath modules for HXT.

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

Text.XML.HXT.XPath.XPathDataTypes

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 XPNumber
  - = Float Float
  - | NaN
  - | NegInf
  - | Neg0
  - | Pos0
  - | PosInf
- newtype NodeSet = NS {
  - unNS :: Map NodePath NavXmlTree
  }
- data Op
  - = Or
  - | And
  - | Eq
  - | NEq
  - | Less
  - | Greater
  - | LessEq
  - | GreaterEq
  - | Plus
  - | Minus
  - | Div
  - | Mod
  - | Mult
  - | Unary
  - | Union
- type Name = (NamePrefix, LocalName)
- data AxisSpec
  - = Ancestor
  - | AncestorOrSelf
  - | Attribute
  - | Child
  - | Descendant
  - | DescendantOrSelf
  - | Following
  - | FollowingSibling
  - | Namespace
  - | Parent
  - | Preceding
  - | PrecedingSibling
  - | Self
- type VarName = Name
- data XStep = Step AxisSpec NodeTest [Expr]
- data Expr
  - = GenExpr Op [Expr]
  - | PathExpr (Maybe Expr) (Maybe LocationPath)
  - | FilterExpr [Expr]
  - | VarExpr VarName
  - | LiteralExpr Literal
  - | NumberExpr XPNumber
  - | FctExpr FctName FctArguments
- data LocationPath = LocPath Path [XStep]
- type Literal = String
- type FctName = String
- type FctArguments = [Expr]
- data Path
  - = Rel
  - | Abs
- data NodeTest
  - = NameTest QName
  - | PI String
  - | TypeTest XPathNode
- data XPathNode
  - = XPNode
  - | XPCommentNode
  - | XPPINode
  - | XPTextNode
- type NamePrefix = String
- type LocalName = String
- type Context = (ConPos, ConLen, ConNode)
- type ConPos = Int
- type ConLen = Int
- type ConNode = NavXmlTree
- type NavXmlTree = NavTree XNode
- data XPathValue
  - = XPVNode NodeSet
  - | XPVBool Bool
  - | XPVNumber XPNumber
  - | XPVString String
  - | XPVError String
- type NavXmlTrees = [NavXmlTree]
- type NodePath = [Int]
- type XPathFilter = XPathValue -> XPathValue
- withXPVNode :: String -> (NodeSet -> XPathValue) -> XPathFilter
- emptyNodeSet :: NodeSet
- singletonNodeSet :: NavXmlTree -> NodeSet
- toNodeSet :: NavXmlTrees -> NodeSet
- nullNodeSet :: NodeSet -> Bool
- cardNodeSet :: NodeSet -> Int
- deleteNodeSet :: NodePath -> NodeSet -> NodeSet
- insertNodeSet :: NavXmlTree -> NodeSet -> NodeSet
- unionNodeSet :: NodeSet -> NodeSet -> NodeSet
- unionsNodeSet :: [NodeSet] -> NodeSet
- elemsNodeSet :: NodeSet -> [(NodePath, NavXmlTree)]
- fromNodeSet :: NodeSet -> NavXmlTrees
- headNodeSet :: NodeSet -> NavXmlTree
- withNodeSet :: (NavXmlTrees -> NavXmlTrees) -> NodeSet -> NodeSet
- type VarTab = [(VarName, XPathValue)]
- type KeyTab = [(QName, String, NavXmlTree)]
- type Env = (VarTab, KeyTab)
- varEnv :: Env
- module Text.XML.HXT.XPath.NavTree

# Documentation

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 Float | floating-point number
NaN | not-a-number
NegInf | negative infinity
Neg0 | negative zero
Pos0 | positive zero
PosInf | positive infinity

#### Instances

Instances details

Show XPNumber Source # |
Instance details Defined in Text.XML.HXT.XPath.XPathDataTypes Methods showsPrec :: Int -> XPNumber -> ShowS Source # show :: XPNumber -> String Source # showList :: [XPNumber] -> ShowS Source #
Eq XPNumber Source # |
Instance details Defined in Text.XML.HXT.XPath.XPathDataTypes Methods (==) :: XPNumber -> XPNumber -> Bool Source # (/=) :: XPNumber -> XPNumber -> Bool Source #
Ord XPNumber Source # |

Instance details

Defined in Text.XML.HXT.XPath.XPathDataTypes

Methods

compare :: XPNumber -> XPNumber -> Ordering Source #

(<) :: XPNumber -> XPNumber -> Bool Source #

(<=) :: XPNumber -> XPNumber -> Bool Source #

(>) :: XPNumber -> XPNumber -> Bool Source #

(>=) :: XPNumber -> XPNumber -> Bool Source #

max :: XPNumber -> XPNumber -> XPNumber Source #

min :: XPNumber -> XPNumber -> XPNumber Source #

newtype NodeSet Source #

Set of navigable trees identified by their document position (NodePath)

Constructors

NS |

Fields

- unNS :: Map NodePath NavXmlTree

#### Instances

Instances details

Show NodeSet Source # |
Instance details Defined in Text.XML.HXT.XPath.XPathDataTypes Methods showsPrec :: Int -> NodeSet -> ShowS Source # show :: NodeSet -> String Source # showList :: [NodeSet] -> ShowS Source #
Eq NodeSet Source # |
Instance details Defined in Text.XML.HXT.XPath.XPathDataTypes Methods (==) :: NodeSet -> NodeSet -> Bool Source # (/=) :: NodeSet -> NodeSet -> Bool Source #
Ord NodeSet Source # |
Instance details Defined in Text.XML.HXT.XPath.XPathDataTypes Methods compare :: NodeSet -> NodeSet -> Ordering Source # (<) :: NodeSet -> NodeSet -> Bool Source # (<=) :: NodeSet -> NodeSet -> Bool Source # (>) :: NodeSet -> NodeSet -> Bool Source # (>=) :: NodeSet -> NodeSet -> Bool Source # max :: NodeSet -> NodeSet -> NodeSet Source # min :: NodeSet -> NodeSet -> NodeSet Source #

data Op Source #

Represents XPath operators

Constructors

Or |
And |
Eq |
NEq |
Less |
Greater |
LessEq |
GreaterEq |
Plus |
Minus |
Div |
Mod |
Mult |
Unary |
Union |

#### Instances

Instances details

Show Op Source # |
Instance details Defined in Text.XML.HXT.XPath.XPathDataTypes Methods showsPrec :: Int -> Op -> ShowS Source # show :: Op -> String Source # showList :: [Op] -> ShowS Source #
Eq Op Source # |
Instance details Defined in Text.XML.HXT.XPath.XPathDataTypes Methods (==) :: Op -> Op -> Bool Source # (/=) :: Op -> Op -> Bool Source #

type Name = (NamePrefix, LocalName) Source #

data AxisSpec Source #

Represents XPath axis

Constructors

Ancestor |
AncestorOrSelf |
Attribute |
Child |
Descendant |
DescendantOrSelf |
Following |
FollowingSibling |
Namespace |
Parent |
Preceding |
PrecedingSibling |
Self |

#### Instances

Instances details

Show AxisSpec Source # |
Instance details Defined in Text.XML.HXT.XPath.XPathDataTypes Methods showsPrec :: Int -> AxisSpec -> ShowS Source # show :: AxisSpec -> String Source # showList :: [AxisSpec] -> ShowS Source #
Eq AxisSpec Source # |
Instance details Defined in Text.XML.HXT.XPath.XPathDataTypes Methods (==) :: AxisSpec -> AxisSpec -> Bool Source # (/=) :: AxisSpec -> AxisSpec -> Bool Source #

type VarName = Name Source #

Variable name

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] |

#### Instances

Instances details

Show XStep Source # |
Instance details Defined in Text.XML.HXT.XPath.XPathDataTypes Methods showsPrec :: Int -> XStep -> ShowS Source # show :: XStep -> String Source # showList :: [XStep] -> ShowS Source #
Eq XStep Source # |
Instance details Defined in Text.XML.HXT.XPath.XPathDataTypes Methods (==) :: XStep -> XStep -> Bool Source # (/=) :: XStep -> XStep -> Bool Source #

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 VarName | variable
LiteralExpr Literal | string
NumberExpr XPNumber | number
FctExpr FctName FctArguments | a function with a name and an optional list of arguments

#### Instances

Instances details

Show Expr Source # |
Instance details Defined in Text.XML.HXT.XPath.XPathDataTypes Methods showsPrec :: Int -> Expr -> ShowS Source # show :: Expr -> String Source # showList :: [Expr] -> ShowS Source #
Eq Expr Source # |
Instance details Defined in Text.XML.HXT.XPath.XPathDataTypes Methods (==) :: Expr -> Expr -> Bool Source # (/=) :: Expr -> Expr -> Bool Source #

data LocationPath Source #

Represents location path

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

Constructors

LocPath Path [XStep] |

#### Instances

Instances details

Show LocationPath Source # |
Instance details Defined in Text.XML.HXT.XPath.XPathDataTypes Methods showsPrec :: Int -> LocationPath -> ShowS Source # show :: LocationPath -> String Source # showList :: [LocationPath] -> ShowS Source #
Eq LocationPath Source # |
Instance details Defined in Text.XML.HXT.XPath.XPathDataTypes Methods (==) :: LocationPath -> LocationPath -> Bool Source # (/=) :: LocationPath -> LocationPath -> Bool Source #

type Literal = String Source #

a string

type FctName = String Source #

Function name

type FctArguments = [Expr] Source #

Function arguments

data Path Source #

A location path is either a relative or an absolute path.

Constructors

Rel |
Abs |

#### Instances

Instances details

Show Path Source # |
Instance details Defined in Text.XML.HXT.XPath.XPathDataTypes Methods showsPrec :: Int -> Path -> ShowS Source # show :: Path -> String Source # showList :: [Path] -> ShowS Source #
Eq Path Source # |
Instance details Defined in Text.XML.HXT.XPath.XPathDataTypes Methods (==) :: Path -> Path -> Bool Source # (/=) :: Path -> Path -> Bool Source #

data NodeTest Source #

Represents XPath node-tests

Constructors

NameTest QName | name-test
PI String | processing-instruction-test with a literal argument
TypeTest XPathNode | all nodetype-tests

#### Instances

Instances details

Show NodeTest Source # |
Instance details Defined in Text.XML.HXT.XPath.XPathDataTypes Methods showsPrec :: Int -> NodeTest -> ShowS Source # show :: NodeTest -> String Source # showList :: [NodeTest] -> ShowS Source #
Eq NodeTest Source # |
Instance details Defined in Text.XML.HXT.XPath.XPathDataTypes Methods (==) :: NodeTest -> NodeTest -> Bool Source # (/=) :: NodeTest -> NodeTest -> Bool Source #

data XPathNode Source #

Represents nodetype-tests

Constructors

XPNode | all 7 nodetypes (root, element, attribute, namespace, pi, comment, text)
XPCommentNode | comment-nodes
XPPINode | processing-instruction-nodes
XPTextNode | text-nodes: cdata, character data

#### Instances

Instances details

Show XPathNode Source # |
Instance details Defined in Text.XML.HXT.XPath.XPathDataTypes Methods showsPrec :: Int -> XPathNode -> ShowS Source # show :: XPathNode -> String Source # showList :: [XPathNode] -> ShowS Source #
Eq XPathNode Source # |
Instance details Defined in Text.XML.HXT.XPath.XPathDataTypes Methods (==) :: XPathNode -> XPathNode -> Bool Source # (/=) :: XPathNode -> XPathNode -> Bool Source #

type NamePrefix = String Source #

type LocalName = String Source #

type Context = (ConPos, ConLen, ConNode) Source #

Evaluation context

type ConPos = Int Source #

Context position

type ConLen = Int Source #

Context length

type ConNode = NavXmlTree Source #

Context node

type NavXmlTree = NavTree XNode Source #

Node of navigable tree representation

data XPathValue Source #

Represents XPath results

Constructors

XPVNode NodeSet | node-set
XPVBool Bool | boolean value
XPVNumber XPNumber | number according the IEEE 754 standard
XPVString String | string value
XPVError String | error message with text

#### Instances

Instances details

Show XPathValue Source # |
Instance details Defined in Text.XML.HXT.XPath.XPathDataTypes Methods showsPrec :: Int -> XPathValue -> ShowS Source # show :: XPathValue -> String Source # showList :: [XPathValue] -> ShowS Source #
Eq XPathValue Source # |
Instance details Defined in Text.XML.HXT.XPath.XPathDataTypes Methods (==) :: XPathValue -> XPathValue -> Bool Source # (/=) :: XPathValue -> XPathValue -> Bool Source #
Ord XPathValue Source # |

Instance details

Defined in Text.XML.HXT.XPath.XPathDataTypes

Methods

compare :: XPathValue -> XPathValue -> Ordering Source #

(<) :: XPathValue -> XPathValue -> Bool Source #

(<=) :: XPathValue -> XPathValue -> Bool Source #

(>) :: XPathValue -> XPathValue -> Bool Source #

(>=) :: XPathValue -> XPathValue -> Bool Source #

max :: XPathValue -> XPathValue -> XPathValue Source #

min :: XPathValue -> XPathValue -> XPathValue Source #

type NavXmlTrees = [NavXmlTree] Source #

List of nodes of navigable tree representation

type NodePath = [Int] Source #

path represented as list of indices starting at root

type XPathFilter = XPathValue -> XPathValue Source #

A functions that takes a XPath result and returns a XPath result

withXPVNode :: String -> (NodeSet -> XPathValue) -> XPathFilter Source #

emptyNodeSet :: NodeSet Source #

node set functions

singletonNodeSet :: NavXmlTree -> NodeSet Source #

toNodeSet :: NavXmlTrees -> NodeSet Source #

nullNodeSet :: NodeSet -> Bool Source #

cardNodeSet :: NodeSet -> Int Source #

deleteNodeSet :: NodePath -> NodeSet -> NodeSet Source #

insertNodeSet :: NavXmlTree -> NodeSet -> NodeSet Source #

unionNodeSet :: NodeSet -> NodeSet -> NodeSet Source #

unionsNodeSet :: [NodeSet] -> NodeSet Source #

elemsNodeSet :: NodeSet -> [(NodePath, NavXmlTree)] Source #

fromNodeSet :: NodeSet -> NavXmlTrees Source #

headNodeSet :: NodeSet -> NavXmlTree Source #

withNodeSet :: (NavXmlTrees -> NavXmlTrees) -> NodeSet -> NodeSet Source #

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

module Text.XML.HXT.XPath.NavTree