packages feed

hxt 8.4.1 → 8.5.0

raw patch · 23 files changed

+6/−5462 lines, 23 filesdep ~tagsoupPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: tagsoup

API changes (from Hackage documentation)

- Data.NavTree: NT :: (NTree a) -> [NavTree a] -> [NTree a] -> [NTree a] -> NavTree a
- Data.NavTree: data NavTree a
- Data.NavTree: dataNT :: NavTree a -> a
- Data.NavTree: downNT :: NavTree a -> Maybe (NavTree a)
- Data.NavTree: getChildrenNT :: NavTree a -> [NavTree a]
- Data.NavTree: instance (Eq a) => Eq (NavTree a)
- Data.NavTree: instance (Ord a) => Ord (NavTree a)
- Data.NavTree: instance (Show a) => Show (NavTree a)
- Data.NavTree: leftNT :: NavTree a -> Maybe (NavTree a)
- Data.NavTree: maybePlus :: (a -> Maybe a) -> a -> [a]
- Data.NavTree: maybeStar :: (a -> Maybe a) -> a -> [a]
- Data.NavTree: ntree :: NTree a -> NavTree a
- Data.NavTree: o' :: (Monad m) => (b -> m c) -> (a -> m b) -> (a -> m c)
- Data.NavTree: preorderNT :: NavTree a -> [NavTree a]
- Data.NavTree: revPreorderNT :: NavTree a -> [NavTree a]
- Data.NavTree: rightNT :: NavTree a -> Maybe (NavTree a)
- Data.NavTree: subtreeNT :: NavTree a -> NTree a
- Data.NavTree: upNT :: NavTree a -> Maybe (NavTree a)
- Text.XML.HXT.Arrow.XPath: getElemAndAttrNodeSet :: (ArrowXml a) => a XmlTree XmlTree -> a XmlTree XmlNodeSet
- Text.XML.HXT.Arrow.XPath: getElemNodeSet :: (ArrowXml a) => a XmlTree XmlTree -> a XmlTree XmlNodeSet
- Text.XML.HXT.Arrow.XPath: getFromNodeSet :: (ArrowXml a) => XmlNodeSet -> a XmlTree XmlTree
- Text.XML.HXT.Arrow.XPath: getXPathNodeSet :: (ArrowXml a) => String -> a XmlTree XmlNodeSet
- Text.XML.HXT.Arrow.XPath: getXPathTrees :: (ArrowXml a) => String -> a XmlTree XmlTree
- Text.XML.HXT.Arrow.XPath: getXPathTreesInDoc :: (ArrowXml a) => String -> a XmlTree XmlTree
- Text.XML.HXT.Arrow.XPath: getXPathTreesInDocWithNsEnv :: (ArrowXml a) => Attributes -> String -> a XmlTree XmlTree
- Text.XML.HXT.Arrow.XPath: getXPathTreesWithNsEnv :: (ArrowXml a) => Attributes -> String -> a XmlTree XmlTree
- Text.XML.HXT.Arrow.XPath: processFromNodeSet :: (ArrowXml a) => a XmlTree XmlTree -> XmlNodeSet -> a XmlTree XmlTree
- Text.XML.HXT.Arrow.XPath: processXPathTrees :: (ArrowXml a) => a XmlTree XmlTree -> String -> a XmlTree XmlTree
- Text.XML.HXT.Arrow.XPath: processXPathTreesWithNsEnv :: (ArrowXml a) => a XmlTree XmlTree -> Attributes -> String -> a XmlTree XmlTree
- Text.XML.HXT.Arrow.XPathSimple: (&&&&) :: XPArrow b b -> XPArrow b b -> XPArrow b (b, b)
- Text.XML.HXT.Arrow.XPathSimple: (<+>>) :: XPArrow b b -> XPArrow b b -> XPArrow b b
- Text.XML.HXT.Arrow.XPathSimple: (>>>>) :: XPArrow b b -> XPArrow b b -> XPArrow b b
- Text.XML.HXT.Arrow.XPathSimple: compBool :: (MonadPlus m) => Op -> Expr -> Expr -> m (XPArrow XmlTree XmlTree)
- Text.XML.HXT.Arrow.XPathSimple: compBoolExpr :: (MonadPlus m) => Expr -> m Bool
- Text.XML.HXT.Arrow.XPathSimple: compFP :: (MonadPlus m) => [Expr] -> XPArrow XmlTree XmlTree -> m (XPArrow XmlTree XmlTree)
- Text.XML.HXT.Arrow.XPathSimple: compGenExpr :: (MonadPlus m) => Expr -> m (XPArrow XmlTree XmlTree)
- Text.XML.HXT.Arrow.XPathSimple: compIntExpr :: (MonadPlus m) => Expr -> m Int
- Text.XML.HXT.Arrow.XPathSimple: compLP :: (MonadPlus m) => [XStep] -> XPArrow XmlTree XmlTree -> m (XPArrow XmlTree XmlTree)
- Text.XML.HXT.Arrow.XPathSimple: compNT :: (Monad m) => NodeTest -> m (XPArrow XmlTree XmlTree)
- Text.XML.HXT.Arrow.XPathSimple: compNTA :: (Monad m) => NodeTest -> m (XPArrow XmlTree XmlTree)
- Text.XML.HXT.Arrow.XPathSimple: compNTE :: (Monad m) => NodeTest -> m (XPArrow XmlTree XmlTree)
- Text.XML.HXT.Arrow.XPathSimple: compNameT :: (Monad m) => LA XmlTree XmlTree -> QName -> m (XPArrow XmlTree XmlTree)
- Text.XML.HXT.Arrow.XPathSimple: compNumber :: (MonadPlus m) => Op -> Expr -> Expr -> m (XPArrow XmlTree XmlTree)
- Text.XML.HXT.Arrow.XPathSimple: compNumberExpr :: (MonadPlus m) => Expr -> m XPNumber
- Text.XML.HXT.Arrow.XPathSimple: compPath :: (MonadPlus m) => Op -> Expr -> Expr -> m (XPArrow XmlTree XmlTree)
- Text.XML.HXT.Arrow.XPathSimple: compPred :: (MonadPlus m) => [Expr] -> XPArrow XmlTree XmlTree -> m (XPArrow XmlTree XmlTree)
- Text.XML.HXT.Arrow.XPathSimple: compPred1 :: (MonadPlus m) => Expr -> XPArrow XmlTree XmlTree -> m (XPArrow XmlTree XmlTree)
- Text.XML.HXT.Arrow.XPathSimple: compRelPathExpr :: (MonadPlus m) => Expr -> m (XPArrow XmlTree XmlTree)
- Text.XML.HXT.Arrow.XPathSimple: compString :: (MonadPlus m) => Op -> Expr -> Expr -> m (XPArrow XmlTree XmlTree)
- Text.XML.HXT.Arrow.XPathSimple: compStringExpr :: (MonadPlus m) => Expr -> m String
- Text.XML.HXT.Arrow.XPathSimple: compXP :: (MonadPlus m) => Expr -> m (XPArrow XmlTree XmlTree)
- Text.XML.HXT.Arrow.XPathSimple: compXPath :: (MonadPlus m) => Expr -> m (LA XmlTree XmlTree)
- Text.XML.HXT.Arrow.XPathSimple: compXS :: (MonadPlus m) => XStep -> XPArrow XmlTree XmlTree -> m (XPArrow XmlTree XmlTree)
- Text.XML.HXT.Arrow.XPathSimple: deadEndStreet :: (Monad m) => m a
- Text.XML.HXT.Arrow.XPathSimple: deep' :: XPArrow XmlTree XmlTree -> XPArrow XmlTree XmlTree
- Text.XML.HXT.Arrow.XPathSimple: equalNodeSet :: (Eq a) => [a] -> [a] -> [a]
- Text.XML.HXT.Arrow.XPathSimple: getAttrl' :: XPArrow XmlTree XmlTree -> XPArrow XmlTree XmlTree
- Text.XML.HXT.Arrow.XPathSimple: getChildren' :: XPArrow XmlTree XmlTree -> XPArrow XmlTree XmlTree
- Text.XML.HXT.Arrow.XPathSimple: getXP :: NsEnv -> String -> LA XmlTree XmlTree
- Text.XML.HXT.Arrow.XPathSimple: getXPathTrees :: (ArrowXml a) => String -> a XmlTree XmlTree
- Text.XML.HXT.Arrow.XPathSimple: getXPathTreesInDoc :: (ArrowXml a) => String -> a XmlTree XmlTree
- Text.XML.HXT.Arrow.XPathSimple: getXPathTreesInDocWithNsEnv :: (ArrowXml a) => Attributes -> String -> a XmlTree XmlTree
- Text.XML.HXT.Arrow.XPathSimple: getXPathTreesWithNsEnv :: (ArrowXml a) => Attributes -> String -> a XmlTree XmlTree
- Text.XML.HXT.Arrow.XPathSimple: getXPathTreesWithNsEnvSimple :: (ArrowXml a) => Attributes -> String -> a XmlTree XmlTree
- Text.XML.HXT.Arrow.XPathSimple: guards' :: XPArrow b b -> XPArrow b b -> XPArrow b b
- Text.XML.HXT.Arrow.XPathSimple: mk :: LA b c -> XPArrow b c
- Text.XML.HXT.Arrow.XPathSimple: multi' :: XPArrow XmlTree XmlTree -> XPArrow XmlTree XmlTree
- Text.XML.HXT.Arrow.XPathSimple: this' :: XPArrow b b
- Text.XML.HXT.Arrow.XPathSimple: this'' :: XPArrow b b
- Text.XML.HXT.Arrow.XPathSimple: toNumber :: String -> XPNumber
- Text.XML.HXT.Arrow.XPathSimple: toThis :: XPArrow b b -> XPArrow b b
- Text.XML.HXT.Arrow.XPathSimple: tryGetXPath :: (ArrowXml a) => Attributes -> String -> a XmlTree XmlTree
- Text.XML.HXT.Arrow.XPathSimple: type XPArrow b c = Maybe (LA b c)
- Text.XML.HXT.Arrow.XPathSimple: unwrap :: XPArrow b b -> LA b b
- Text.XML.HXT.Arrow.XPathSimple: xIndex :: Int -> LA [b] b
- Text.XML.HXT.Arrow.XPathSimple: xNumber' :: XPArrow XmlTree XmlTree -> LA XmlTree XPNumber
- Text.XML.HXT.Arrow.XPathSimple: xString :: XPArrow XmlTree XmlTree -> LA XmlTree String
- Text.XML.HXT.XPath.NavTree: ancestorAxis :: NavTree a -> [NavTree a]
- Text.XML.HXT.XPath.NavTree: ancestorOrSelfAxis :: NavTree a -> [NavTree a]
- Text.XML.HXT.XPath.NavTree: attributeAxis :: NavTree XNode -> [NavTree XNode]
- Text.XML.HXT.XPath.NavTree: childAxis :: NavTree a -> [NavTree a]
- Text.XML.HXT.XPath.NavTree: descendantAxis :: NavTree a -> [NavTree a]
- Text.XML.HXT.XPath.NavTree: descendantOrSelfAxis :: NavTree a -> [NavTree a]
- Text.XML.HXT.XPath.NavTree: followingAxis :: NavTree a -> [NavTree a]
- Text.XML.HXT.XPath.NavTree: followingSiblingAxis :: NavTree a -> [NavTree a]
- Text.XML.HXT.XPath.NavTree: parentAxis :: NavTree a -> [NavTree a]
- Text.XML.HXT.XPath.NavTree: precedingAxis :: NavTree a -> [NavTree a]
- Text.XML.HXT.XPath.NavTree: precedingSiblingAxis :: NavTree a -> [NavTree a]
- Text.XML.HXT.XPath.NavTree: selfAxis :: NavTree a -> [NavTree a]
- Text.XML.HXT.XPath.XPathArithmetic: xPathAdd :: Op -> XPathValue -> XPathFilter
- Text.XML.HXT.XPath.XPathArithmetic: xPathDiv :: Op -> XPathValue -> XPathFilter
- Text.XML.HXT.XPath.XPathArithmetic: xPathMod :: Op -> XPathValue -> XPathFilter
- Text.XML.HXT.XPath.XPathArithmetic: xPathMulti :: Op -> XPathValue -> XPathFilter
- Text.XML.HXT.XPath.XPathArithmetic: xPathUnary :: XPathFilter
- Text.XML.HXT.XPath.XPathDataTypes: Abs :: Path
- Text.XML.HXT.XPath.XPathDataTypes: Ancestor :: AxisSpec
- Text.XML.HXT.XPath.XPathDataTypes: AncestorOrSelf :: AxisSpec
- Text.XML.HXT.XPath.XPathDataTypes: And :: Op
- Text.XML.HXT.XPath.XPathDataTypes: Attribute :: AxisSpec
- Text.XML.HXT.XPath.XPathDataTypes: Child :: AxisSpec
- Text.XML.HXT.XPath.XPathDataTypes: Descendant :: AxisSpec
- Text.XML.HXT.XPath.XPathDataTypes: DescendantOrSelf :: AxisSpec
- Text.XML.HXT.XPath.XPathDataTypes: Div :: Op
- Text.XML.HXT.XPath.XPathDataTypes: Eq :: Op
- Text.XML.HXT.XPath.XPathDataTypes: FctExpr :: FctName -> FctArguments -> Expr
- Text.XML.HXT.XPath.XPathDataTypes: FilterExpr :: [Expr] -> Expr
- Text.XML.HXT.XPath.XPathDataTypes: Float :: Float -> XPNumber
- Text.XML.HXT.XPath.XPathDataTypes: Following :: AxisSpec
- Text.XML.HXT.XPath.XPathDataTypes: FollowingSibling :: AxisSpec
- Text.XML.HXT.XPath.XPathDataTypes: GenExpr :: Op -> [Expr] -> Expr
- Text.XML.HXT.XPath.XPathDataTypes: Greater :: Op
- Text.XML.HXT.XPath.XPathDataTypes: GreaterEq :: Op
- Text.XML.HXT.XPath.XPathDataTypes: Less :: Op
- Text.XML.HXT.XPath.XPathDataTypes: LessEq :: Op
- Text.XML.HXT.XPath.XPathDataTypes: LiteralExpr :: Literal -> Expr
- Text.XML.HXT.XPath.XPathDataTypes: LocPath :: Path -> [XStep] -> LocationPath
- Text.XML.HXT.XPath.XPathDataTypes: Minus :: Op
- Text.XML.HXT.XPath.XPathDataTypes: Mod :: Op
- Text.XML.HXT.XPath.XPathDataTypes: Mult :: Op
- Text.XML.HXT.XPath.XPathDataTypes: NEq :: Op
- Text.XML.HXT.XPath.XPathDataTypes: NaN :: XPNumber
- Text.XML.HXT.XPath.XPathDataTypes: NameTest :: QName -> NodeTest
- Text.XML.HXT.XPath.XPathDataTypes: Namespace :: AxisSpec
- Text.XML.HXT.XPath.XPathDataTypes: Neg0 :: XPNumber
- Text.XML.HXT.XPath.XPathDataTypes: NegInf :: XPNumber
- Text.XML.HXT.XPath.XPathDataTypes: NumberExpr :: XPNumber -> Expr
- Text.XML.HXT.XPath.XPathDataTypes: Or :: Op
- Text.XML.HXT.XPath.XPathDataTypes: PI :: String -> NodeTest
- Text.XML.HXT.XPath.XPathDataTypes: Parent :: AxisSpec
- Text.XML.HXT.XPath.XPathDataTypes: PathExpr :: (Maybe Expr) -> (Maybe LocationPath) -> Expr
- Text.XML.HXT.XPath.XPathDataTypes: Plus :: Op
- Text.XML.HXT.XPath.XPathDataTypes: Pos0 :: XPNumber
- Text.XML.HXT.XPath.XPathDataTypes: PosInf :: XPNumber
- Text.XML.HXT.XPath.XPathDataTypes: Preceding :: AxisSpec
- Text.XML.HXT.XPath.XPathDataTypes: PrecedingSibling :: AxisSpec
- Text.XML.HXT.XPath.XPathDataTypes: Rel :: Path
- Text.XML.HXT.XPath.XPathDataTypes: Self :: AxisSpec
- Text.XML.HXT.XPath.XPathDataTypes: Step :: AxisSpec -> NodeTest -> [Expr] -> XStep
- Text.XML.HXT.XPath.XPathDataTypes: TypeTest :: XPathNode -> NodeTest
- Text.XML.HXT.XPath.XPathDataTypes: Unary :: Op
- Text.XML.HXT.XPath.XPathDataTypes: Union :: Op
- Text.XML.HXT.XPath.XPathDataTypes: VarExpr :: VarName -> Expr
- Text.XML.HXT.XPath.XPathDataTypes: XPCommentNode :: XPathNode
- Text.XML.HXT.XPath.XPathDataTypes: XPNode :: XPathNode
- Text.XML.HXT.XPath.XPathDataTypes: XPPINode :: XPathNode
- Text.XML.HXT.XPath.XPathDataTypes: XPTextNode :: XPathNode
- Text.XML.HXT.XPath.XPathDataTypes: XPVBool :: Bool -> XPathValue
- Text.XML.HXT.XPath.XPathDataTypes: XPVError :: String -> XPathValue
- Text.XML.HXT.XPath.XPathDataTypes: XPVNode :: NodeSet -> XPathValue
- Text.XML.HXT.XPath.XPathDataTypes: XPVNumber :: XPNumber -> XPathValue
- Text.XML.HXT.XPath.XPathDataTypes: XPVString :: String -> XPathValue
- Text.XML.HXT.XPath.XPathDataTypes: data AxisSpec
- Text.XML.HXT.XPath.XPathDataTypes: data Expr
- Text.XML.HXT.XPath.XPathDataTypes: data LocationPath
- Text.XML.HXT.XPath.XPathDataTypes: data NodeTest
- Text.XML.HXT.XPath.XPathDataTypes: data Op
- Text.XML.HXT.XPath.XPathDataTypes: data Path
- Text.XML.HXT.XPath.XPathDataTypes: data XPNumber
- Text.XML.HXT.XPath.XPathDataTypes: data XPathNode
- Text.XML.HXT.XPath.XPathDataTypes: data XPathValue
- Text.XML.HXT.XPath.XPathDataTypes: data XStep
- Text.XML.HXT.XPath.XPathDataTypes: instance Eq AxisSpec
- Text.XML.HXT.XPath.XPathDataTypes: instance Eq Expr
- Text.XML.HXT.XPath.XPathDataTypes: instance Eq LocationPath
- Text.XML.HXT.XPath.XPathDataTypes: instance Eq NodeTest
- Text.XML.HXT.XPath.XPathDataTypes: instance Eq Op
- Text.XML.HXT.XPath.XPathDataTypes: instance Eq Path
- Text.XML.HXT.XPath.XPathDataTypes: instance Eq XPNumber
- Text.XML.HXT.XPath.XPathDataTypes: instance Eq XPathNode
- Text.XML.HXT.XPath.XPathDataTypes: instance Eq XPathValue
- Text.XML.HXT.XPath.XPathDataTypes: instance Eq XStep
- Text.XML.HXT.XPath.XPathDataTypes: instance Ord XPNumber
- Text.XML.HXT.XPath.XPathDataTypes: instance Ord XPathValue
- Text.XML.HXT.XPath.XPathDataTypes: instance Show AxisSpec
- Text.XML.HXT.XPath.XPathDataTypes: instance Show Expr
- Text.XML.HXT.XPath.XPathDataTypes: instance Show LocationPath
- Text.XML.HXT.XPath.XPathDataTypes: instance Show NodeTest
- Text.XML.HXT.XPath.XPathDataTypes: instance Show Op
- Text.XML.HXT.XPath.XPathDataTypes: instance Show Path
- Text.XML.HXT.XPath.XPathDataTypes: instance Show XPNumber
- Text.XML.HXT.XPath.XPathDataTypes: instance Show XPathNode
- Text.XML.HXT.XPath.XPathDataTypes: instance Show XPathValue
- Text.XML.HXT.XPath.XPathDataTypes: instance Show XStep
- Text.XML.HXT.XPath.XPathDataTypes: type ConLen = Int
- Text.XML.HXT.XPath.XPathDataTypes: type ConNode = NavXmlTree
- Text.XML.HXT.XPath.XPathDataTypes: type ConPos = Int
- Text.XML.HXT.XPath.XPathDataTypes: type Context = (ConPos, ConLen, ConNode)
- Text.XML.HXT.XPath.XPathDataTypes: type Env = (VarTab, KeyTab)
- Text.XML.HXT.XPath.XPathDataTypes: type FctArguments = [Expr]
- Text.XML.HXT.XPath.XPathDataTypes: type FctName = String
- Text.XML.HXT.XPath.XPathDataTypes: type KeyTab = [(QName, String, NavXmlTree)]
- Text.XML.HXT.XPath.XPathDataTypes: type Literal = String
- Text.XML.HXT.XPath.XPathDataTypes: type LocalName = String
- Text.XML.HXT.XPath.XPathDataTypes: type Name = (NamePrefix, LocalName)
- Text.XML.HXT.XPath.XPathDataTypes: type NamePrefix = String
- Text.XML.HXT.XPath.XPathDataTypes: type NavXmlTree = NavTree XNode
- Text.XML.HXT.XPath.XPathDataTypes: type NavXmlTrees = [NavXmlTree]
- Text.XML.HXT.XPath.XPathDataTypes: type NodeSet = NavXmlTrees
- Text.XML.HXT.XPath.XPathDataTypes: type VarName = Name
- Text.XML.HXT.XPath.XPathDataTypes: type VarTab = [(VarName, XPathValue)]
- Text.XML.HXT.XPath.XPathDataTypes: type XPathFilter = XPathValue -> XPathValue
- Text.XML.HXT.XPath.XPathDataTypes: varEnv :: Env
- Text.XML.HXT.XPath.XPathEval: evalExpr :: Env -> Context -> Expr -> XPathFilter
- Text.XML.HXT.XPath.XPathEval: getXPath :: String -> XmlTree -> XmlTrees
- Text.XML.HXT.XPath.XPathEval: getXPathNodeSet :: String -> XmlTree -> XmlNodeSet
- Text.XML.HXT.XPath.XPathEval: getXPathNodeSetWithNsEnv :: Attributes -> String -> XmlTree -> XmlNodeSet
- Text.XML.HXT.XPath.XPathEval: getXPathSubTrees :: String -> XmlTree -> XmlTrees
- Text.XML.HXT.XPath.XPathEval: getXPathSubTreesWithNsEnv :: Attributes -> String -> XmlTree -> XmlTrees
- Text.XML.HXT.XPath.XPathEval: getXPathWithNsEnv :: Attributes -> String -> XmlTree -> XmlTrees
- Text.XML.HXT.XPath.XPathFct: createDocumentOrder :: XPathFilter
- Text.XML.HXT.XPath.XPathFct: createDocumentOrderReverse :: XPathFilter
- Text.XML.HXT.XPath.XPathFct: evalFct :: FctName -> Env -> Context -> [XPathValue] -> XPathValue
- Text.XML.HXT.XPath.XPathFct: getConvFct :: XPathValue -> Maybe XFct
- Text.XML.HXT.XPath.XPathFct: getKeyTab :: Env -> KeyTab
- Text.XML.HXT.XPath.XPathFct: getVarTab :: Env -> VarTab
- Text.XML.HXT.XPath.XPathFct: instance Eq IdPathStep
- Text.XML.HXT.XPath.XPathFct: instance Ord IdPathStep
- Text.XML.HXT.XPath.XPathFct: instance Show IdPathStep
- Text.XML.HXT.XPath.XPathFct: isNotInNodeList :: NavXmlTree -> [NavXmlTree] -> Bool
- Text.XML.HXT.XPath.XPathFct: remDups :: XPathFilter
- Text.XML.HXT.XPath.XPathFct: stringValue :: NavXmlTree -> XPathValue
- Text.XML.HXT.XPath.XPathFct: toXValue :: XFct -> Context -> Env -> [XPathValue] -> [XPathValue]
- Text.XML.HXT.XPath.XPathFct: type XFct = Context -> Env -> [XPathValue] -> XPathValue
- Text.XML.HXT.XPath.XPathFct: xboolean :: XFct
- Text.XML.HXT.XPath.XPathFct: xnumber :: XFct
- Text.XML.HXT.XPath.XPathFct: xstring :: XFct
- Text.XML.HXT.XPath.XPathKeywords: a_ancestor :: String
- Text.XML.HXT.XPath.XPathKeywords: a_ancestor_or_self :: String
- Text.XML.HXT.XPath.XPathKeywords: a_attribute :: String
- Text.XML.HXT.XPath.XPathKeywords: a_child :: String
- Text.XML.HXT.XPath.XPathKeywords: a_descendant :: String
- Text.XML.HXT.XPath.XPathKeywords: a_descendant_or_self :: String
- Text.XML.HXT.XPath.XPathKeywords: a_following :: String
- Text.XML.HXT.XPath.XPathKeywords: a_following_sibling :: String
- Text.XML.HXT.XPath.XPathKeywords: a_namespace :: String
- Text.XML.HXT.XPath.XPathKeywords: a_parent :: String
- Text.XML.HXT.XPath.XPathKeywords: a_preceding :: String
- Text.XML.HXT.XPath.XPathKeywords: a_preceding_sibling :: String
- Text.XML.HXT.XPath.XPathKeywords: a_self :: String
- Text.XML.HXT.XPath.XPathKeywords: n_comment :: String
- Text.XML.HXT.XPath.XPathKeywords: n_node :: String
- Text.XML.HXT.XPath.XPathKeywords: n_processing_instruction :: String
- Text.XML.HXT.XPath.XPathKeywords: n_text :: String
- Text.XML.HXT.XPath.XPathParser: parseNumber :: String -> XPathValue
- Text.XML.HXT.XPath.XPathParser: parseXPath :: XParser Expr
- Text.XML.HXT.XPath.XPathToNodeSet: emptyNodeSet :: XmlNodeSet
- Text.XML.HXT.XPath.XPathToNodeSet: xPValue2NodeSet :: XPathValue -> XmlNodeSet
- Text.XML.HXT.XPath.XPathToString: expr2XPathTree :: Expr -> XPathTree
- Text.XML.HXT.XPath.XPathToString: nt2XPathTree :: NodeTest -> XPathTree
- Text.XML.HXT.XPath.XPathToString: pred2XPathTree :: [Expr] -> XPathTree
- Text.XML.HXT.XPath.XPathToString: toXPathTree :: [NavTree a] -> [NTree a]
- Text.XML.HXT.XPath.XPathToString: xPValue2String :: XPathValue -> String
- Text.XML.HXT.XPath.XPathToString: xPValue2XmlTrees :: XPathValue -> XmlTrees

Files

examples/arrows/AGentleIntroductionToHXT/SimpleExamples.hs view
@@ -8,6 +8,7 @@ where  import Text.XML.HXT.Arrow		-- import HXT stuff+import Text.XML.HXT.XPath  import Data.List			-- auxiliary functions import Data.Maybe
− examples/arrows/hxpath/.ghci
@@ -1,4 +0,0 @@-:set -package-conf ../../../lib/hxt/package.conf-:set -package hxt-:set -Wall-:load HXPath
− examples/arrows/hxpath/HXPath.hs
@@ -1,151 +0,0 @@--- --------------------------------------------------------------{- |-   Module     : HXPath-   Copyright  : Copyright (C) 2005 Torbel Kuseler, Uwe Schmidt-   License    : MIT--   Maintainer : Uwe Schmidt-   Maintainer : uwe@fh-wedel.de-   Stability  : experimental-   Portability: portable-   Version    : $Id: HXPath.hs,v 1.2 2006/05/11 14:47:18 hxml Exp $--HXPath - XPath Evaluator of the Haskell XML Toolbox (Arrow version)---}---- --------------------------------------------------------------module Main-where--import Text.XML.HXT.Arrow--import System.IO			-- import the IO and commandline option stuff-import System.Environment-import System.Console.GetOpt-import System.Exit--import Data.Maybe---- ---------------------------------------------------------------- |--- the main program--main :: IO ()-main-    = do-      argv <- getArgs					-- get the commandline arguments-      (al, expr, src) <- cmdlineOpts argv			-- and evaluate them, return a key-value list-      [rc]  <- runX (xpath al expr src)			-- run the parser arrow-      exitProg (rc >= c_err)				-- set return code and terminate---- --------------------------------------------------------------exitProg	:: Bool -> IO a-exitProg True	= exitWith (ExitFailure (-1))-exitProg False	= exitWith ExitSuccess---- ---------------------------------------------------------------- |--- the /real/ main program------ runs in the trivial XmlState monad (with user state set to ())--- so IO and access to global options is possible--xpath	:: Attributes -> String -> String -> IOSArrow b Int-xpath al expr src-    = readDocument al src-      >>>-      evalXPathExpr-      >>>-      traceMsg 1 "evaluation finished"-      >>>-      traceSource-      >>>-      traceTree-      >>>-      formatXPathResult-      >>>-      writeDocument al "-"-      >>>-      getErrStatus-    where-    evalXPathExpr	:: IOSArrow XmlTree XmlTree-    evalXPathExpr-	= traceMsg 1 ("evaluating XPath expression: " ++ expr)-	  >>>-	  replaceChildren ( getXPathTreesInDoc expr-			    >>>-			    filterErrorMsg-			  )--    formatXPathResult	:: IOSArrow XmlTree XmlTree-    formatXPathResult-	= replaceChildren ( mkelem "xpath-result"-			    [ sattr "expr" expr, sattr "source" src ]-			    [ newline, getChildren >>> (this <+> newline) ]-			  )-	where-	newline-	    | isJust . lookup a_indent $ al = txt "\n"-	    | otherwise                     = none---- ------------------------------------------------------------------ the options definition part--- see doc for System.Console.GetOpt--progName	:: String-progName	= "HXPath"-    -options 	:: [OptDescr (String, String)]-options-    = generalOptions-      ++-      inputOptions-      ++-      outputOptions--usage		:: [String] -> IO a-usage errl-    | null errl-	= do-	  hPutStrLn stdout use-	  exitProg False-    | otherwise-	= do-	  hPutStrLn stderr (concat errl ++ "\n" ++ use)-	  exitProg True-    where-    header = "HXPath - XPath Evaluator of the Haskell XML Toolbox (Arrow Version)\n" ++-             "Usage: " ++ progName ++ " [OPTION...] <XPath expr> <URL or FILE>"-    use    = usageInfo header options--cmdlineOpts 	:: [String] -> IO (Attributes, String, String)-cmdlineOpts argv-    = case (getOpt Permute options argv) of-      (ol,n,[]  )-	  -> do-	     (ex, sa) <- src n-	     help (lookup a_help ol)-	     return (ol, ex, sa)-      (_,_,errs)-	  -> usage errs-    where-    src [expr, url]-	= return (expr, url)-    src []-	= usage ["XPath expression and input file/url missing"]-    src [_]-	= usage ["input file/url missing"]-    src _-	= usage ["too many arguments"]--    help Nothing	= return ()-    help (Just _)	= usage []---- ------------------------------------------------------------
− examples/arrows/hxpath/Makefile
@@ -1,59 +0,0 @@-# $Id: Makefile,v 1.2 2005/04/14 12:52:51 hxml Exp $--HXT_HOME	= ../../..-PKGFLAGS	= -GHCFLAGS	= -Wall -O2-GHC		= ghc $(GHCFLAGS) $(PKGFLAGS)--prog		= ./HXPath-prog2		= ./XPathShell--all		: $(prog) $(prog2)--force		:-		$(GHC) --make -o $(prog) $(prog).hs--local		:-		ghc --make -o $(prog2) $(GHCFLAGS) -fglasgow-exts -ignore-package hxt -i../../../src $(prog2).hs--$(prog)		: $(prog).hs-		$(GHC) --make -o $@ $<--$(prog2)	: $(prog2).hs-		$(GHC) --make -o $@ $<--EX		= ../../xhtml/xhtml.xml--test		: $(prog)-		@echo "===> XPath extraction examples" ; echo ; sleep 2-		@$(MAKE) test1 test2 test3 test4--test1		:-		@echo "===> extract all text from the XHTML document" ; echo ; sleep 2-		$(prog) --do-not-validate "/html/body/descendant-or-self::text()" $(EX)-		@echo--test2		:-		@echo "===> extract the 42. paragraph from the XHTML document" ; echo ; sleep 2-		$(prog) --do-not-validate "/descendant::p[position()=42]" $(EX)-		@echo--test3		:-		@echo "===> extract the text of all top level h1 tags from the XHTML document" ; echo ; sleep 2-		$(prog) --indent --do-not-validate "/child::html/child::body/child::h1/descendant-or-self::text()" $(EX)-		@echo--test4		:-		@echo "===> extract all href attributes from a tags from the XHTML document" ; echo ; sleep 2-		$(prog) --indent --do-not-validate "/descendant::a/attribute::href" $(EX)-		@echo--DIST		= $(HXT_HOME)/dist/examples/arrows-DIST_DIR	= $(DIST)/hxpath--dist		:-		[ -d $(DIST_DIR) ] || mkdir -p $(DIST_DIR)-		cp Makefile $(prog).hs $(prog2).hs $(DIST_DIR)--clean		:-		rm -f $(prog) *.hi *.o
− examples/arrows/hxpath/W3CTestData.hs
@@ -1,1079 +0,0 @@-module W3CTestData where--testListW3C=[-		"$h - $i",-		"$hotelnode/location/@country",-		"$in//text()",-		"$l10n.name",-		"$lookup/@text",-		"$start + $step",-		"$texts[position() &gt; 1]",-		"$var1|$var2",-		"$var1|child::child2",-		"$var1|key('key1','Lynne Rosenthal')",-		"$x=''",-		"$x='foo'",-		"$xml-source",-		"$y='foo'",-		"$zoo:bear",-		"' #text'",-		"' 6 ' div 2",-		"' 6 '*div",-		"' x 4'",-		"' x 4'",-		"'....5....|'",-		"'1' and '0'",-		"'2'&gt;'1'",-		"'200'",-		"'ABC'",-		"($terms/table/expand[@language=$lang]/gentext[@key=$key])[1]",-		"((((((n3+5)*(3)+(((n2)+2)*(n1 - 6)))-(n4 - n2))+(-(4-6)))))",-		"(((ancestor::foo)[1])/@att1)",-		"((ancestor::foo))[1]/@att1",-		"(* - 4) div 2",-		"(* - 4)**",-		"(2 + number('xxx'))",-		"(24 div 3 +2) div (40 div 8 -3)",-		"(5 mod 2 = 1) and (5 mod -2 = 1) and (-5 mod 2 = -1) and (-5 mod -2 = -1)",-		"(77 mod $anum + n5 mod 8) mod $anum",-		"(ancestor-or-self::*)[@att1][1]/@att1",-		"(ancestor::foo)[1]/@att1",-		"(ancestor::foo[1])/@att1",-		"(ancestor::section|ancestor::simplesect         |ancestor::articleinfo)[last()]",-		"(chapter//footnote)[2]",-		"(child::chapter/descendant-or-self::node())/footnote[2]",-		"(n1*n2*n3*n4*n5*n6)div n7 div n8 div n9 div n10",-		"(n1/@attrib)*(n2/@attrib)",-		"(n1/@attrib)+(n2/@attrib)",-		"(preceding-sibling::*|following-sibling::*)/ancestor::*[last()]/*[last()]",-		"(preceding-sibling::foo)[1]/@att1",-		"(preceding::foo)[1]/@att1",-		"(section//@title)[7]",-		"(xalan:nodeset($rtf)/default:docelem/test:elem3)", -- namespaces noch mal ueberdenken-		"* +3",-		"*//la | //Bflat | re",-		"*/p",-		"*[$index]",-		"*[$index]",-		"*[$index]",-		"*[1]",-		"*[3]",-		"*[4]",-		"*[@test and position()=1]",-		"*[@test and position()=4]",-		"*[@test and position()=7]",-		"*[@test and position()=8]",-		"*[@test='true']",-		"*[@test][1]/num",-		"*[@test][position()=1]/num",-		"*[last()=position()]",-		"*[last()]",-		"*[local-name()='bar']",-		"*[not(@test)][last()=position()]",-		"*[not(@test)][last()]",-		"*[position()=1]",-		"*[position()=3]",-		"*[position()=4]",-		"*[starts-with(name(.),'f')]",-		"*|@*",-		"*|@*|comment()|processing-instruction()|text()",-		"-(n-2/@attrib) - -(n-1/@attrib)",-		"-(n1|n2)",-		"-.0000000000000000000000000000000000000000123456789",-		"-.01",-		"-n-2 --n-1",-		"-n-2/@attrib --n-1/@attrib",-		"..",-		"../../a/b[1]",-		"..//foo",-		"../@id",-		"../node()",-		"./*[name(.) = $sortcol]",-		".//*[@so]",-		".//PERSONA",-		".//a",-		".//center",-		".//center",-		".//comment()",-		".//f",-		".//near-south/preceding-sibling::*|following-sibling::east/ancestor-or-self::*[2]",-		".//text()",-		".//title",-		"./@id",-		"./@theattrib",-		".0000000000000000000000000000000000000000123456789",-		".01",-		".123456789",-		"/",   -		"/*/@group",-		"//*",-		"//*",-		"//*[count(./*/*) &gt; 0]",-		"//*[count(ancestor::*) &gt;= 2]/../parent::*",-		"//ACT",-		"//ancestor::*",-		"//child1[parent::element1]",-		"//child1|//child2",-		"//child2[ancestor-or-self::element2]",-		"//child2[ancestor::element2]",-		"//child5|//child2|//child4",-		"//comment()",-		"//inc/node4",-		"//item[@type=current()/@name]",-		"//noChild1|//noChild2",-		"//north/dup2 | south/preceding-sibling[4] | north/dup1 | north/*",-		"//processing-instruction()",-		"//xx/descendant::*",-		"/doc/*[@test='true']",-		"/doc/a/b/@attr",-		"/doc/critter[@type='cat']",-		"/doc/mid/inner",-		"/doc/sub1/child1|/doc/sub2/child2",-		"/docs/a",-		"/docs/a",-		"/page/contents/avail/hotel",-		"/sss/sss/i",-		"/sss/sss/i",-		"0 &gt; -0",-		"0 = -0",-		"0 div 0 &gt;= 0",-		"0 div 0 &lt; 0",-		"0 div 0",-		"0 or ''",-		"0",-		"0000000000",-		"1 = '001'",-		"1 = 1.00",-		"1 div -0 = 1 div 0",-		"1 div -0 = 2 div -0",-		"1&gt;1",-		"1&lt;1",-		"1&lt;=1",-		"1-2",-		"10+5+25+20+15+50+35+40",-		"10+7",-		"100-$anum -5-15-$anum",-		"100-9-7-4-17-18-5",-		"100-n6 -4-n1 -1-11",-		"12",-		"123",-		"1234",-		"12345",-		"123456",-		"1234567",-		"12345678",-		"123456789",-		"1234567890",-		"12345678901",-		"123456789012",-		"1234567890123",-		"12345678901234",-		"123456789012345",-		"1234567890123456",-		"12345678901234567",-		"123456789012345678",-		"16-div",-		"1=1",-		"2 * -number('xxx')",-		"2 - number('xxx')",-		"2 div number('xxx')",-		"2 mod number('xxx')",-		"2",-		"2&gt;1",-		"2&gt;=1",-		"2&gt;=2",-		"2&lt;1",-		"2&lt;=1",-		"2*3",-		"2+n5+7+n3",-		"20",-		"25-*",-		"256",-		"3",-		"3",-		"3*2+5*4-4*2-1",-		"3+6",-		"3-1",-		"32",-		"4",-		"4",-		"444 + $t1num",-		"48 mod 17 - 2 mod 9 + 13 mod 5",-		"5 mod 2",-		"5",-		"5",-		"5.*.",-		"5.+*",-		"54 div*",-		"555",-		"56 mod round(n5*2+1.444) - n6 mod 4 + 7 mod n4",-		"6 div -2",-		"6 div 2",-		"6",-		"60",-		"7 - -3",-		"7",-		"7",-		"7+-3",-		"70 div $anum - 18 div n6 + $anum div n2",-		"8",-		"80 div n2 + 12 div 2 - n4 div n2",-		"9",-		"9.87654321012345",-		"98.7654321012345",-		"987.654321012345",-		"9876.54321012345",-		"98765.4321012345",-		"987654.321012345",-		"9876543.21012345",-		"98765432.1012345",-		"987654321.012345",-		"9876543210",-		"9876543210.12345",-		"98765432101.2345",-		"987654321012.345",-		"9876543210123.45",-		"98765432101234.5",-		"FM|PERSONAE|ACT",-		"Name/@First",-		"OL",-		"Personal_Information/Age",-		"Spr/State[. = 'Open']",-		"a/*[last()]",-		"a/child::*[last()]",-		"a/child::comment()[last()]",-		"a/child::node()[last()]",-		"a/child::text()[last()]",-		"a/descendant::*[last()]",-		"a/x",-		"a['3.5' &lt; 4]",-		"a['target'!=descendant::*]",-		"a['target'=descendant::*]",-		"a[('target'=descendant::*) or @squish]",-		"a[(@squeesh or @squish) and @squash]",-		"a[*=9]",-		"a[0 &lt; true()]",-		"a[0]",-		"a[1 &lt; 2]",-		"a[1 &lt; 3]",-		"a[1]",-		"a[3 &gt; following-sibling::*]",-		"a[3 &gt;= following-sibling::*]",-		"a[3 &lt; following-sibling::*]",-		"a[3 &lt;= following-sibling::*]",-		"a[3-2]",-		"a[3.0='3.0']",-		"a[3=following-sibling::*]",-		"a[3]",-		"a[4 != following-sibling::*]",-		"a[4]",-		"a[@squeesh or (@squish and @squash)]",-		"a[@squeesh or @squish and @squash]",-		"a[descendant::*!='target']",-		"a[descendant::*='target']",-		"a[div=9]",-		"a[false()!=following-sibling::*]",-		"a[following-sibling::* != 4]",-		"a[following-sibling::* &gt; 3]",-		"a[following-sibling::* &gt;= 3]",-		"a[following-sibling::* &lt; 3]",-		"a[following-sibling::* &lt;= 3]",-		"a[following-sibling::*!=false()]",-		"a[following-sibling::*=3]",-		"a[following-sibling::*=descendant::*]",-		"a[following-sibling::*=true()]",-		"a[not(('target'=descendant::*) or @squish)]",-		"a[not(@*)]",-		"a[number('3')]",-		"a[position() &lt;=3]",-		"a[position()!=2]",-		"a[position()&gt;2]",-		"a[position()&gt;=2]",-		"a[position()&lt;3]",-		"a[position()=$first]",-		"a[position()=1]",-		"a[position()=3]",-		"a[position()=4]",-		"a[true()='stringwithchars']",-		"a[true()=4]",-		"a[true()=following-sibling::*]",-		"alternate/name/first",-		"ancestor-or-self::*",-		"ancestor-or-self::*[1]",-		"ancestor-or-self::*[1]/text()",-		"ancestor-or-self::*[@att1][1]/@att1",-		"ancestor-or-self::sub | ancestor-or-self::sub-sub",-		"ancestor::*",-		"ancestor::*[3]",-		"ancestor::*[count(child::*) &gt; 1]/*[not(. = current()/ancestor-or-self::*)]",-		"ancestor::foo[1]/@att1",-		"ancestor::sub1|ancestor::sub2",-		"attribute :: *",-		"attribute :: div",-		"attribute*(div - 4)",-		"attribute::*",-		"attribute::*[2]",-		"attribute::attr1|attribute::attr2",-		"attribute::center-attr-2",-		"author/name|author/bibliography/author/chapters",-		"author/name|author/bibliography/author/name",-		"author/name|author/noElement",-		"author[(name/@real='no' and position()=1)]|author[(name/@real='yes' and position()=last())]",-		"author[name/@real='no']|author[name/@real='yes']",-		"author[name='Mary Brady']|author[name/@real='no']",-		"bar | joes:bar",-		"bar[(@a='1' and @b='1') or (@c='1' and @d='1')]",-		"bar[(@a='1' or @b='1') and (@c='1' or @d='1')]",-		"bar[(@a='1' or @b='1') and @c='1']",-		"bar[@a='1' and (@b='1' or @c='1') and @d='1']",-		"bar[@a='1' and @b='1' or @c='1' and @d='1']",-		"bar[@a='1' and @b='1']",-		"bar[@a='1' or (@b='1' and @c='1') or @d='1']",-		"bar[@a='1' or @b='1' and @c='1' or @d='1']",-		"bar[@a='1' or @b='1' or @c='1']",-		"boolean($ResultTreeFragTest)",-		"boolean($emptyResultTreeFragTest)",-		"boolean('')",-		"boolean('0')",-		"boolean(-0)",-		"boolean(0 div 0)",-		"boolean(0)",-		"boolean(1 div 0)",-		"boolean(1)",-		"boolean(doc)",-		"boolean(foo)",-		"ceiling(-1.5)=-1",-		"ceiling(0.0)",-		"ceiling(1)=1",-		"ceiling(1.1)=2",-		"ceiling(1.54)",-		"ceiling(2.999999)",-		"ceiling(n0)",-		"ceiling(n1)",-		"ceiling(n2)",-		"ceiling(number('xxx'))",-		"center//*",-		"center//child::*",-		"center//descendant::*",-		"center/child::*",-		"center/descendant::*",-		"chapter//footnote[1]",-		"chapter//footnote[2]",-		"chapter/descendant::footnote[6]",-		"chapter/note",-		"chapter/note",-		"child :: sub",-		"child1[child::child2]",-		"child::*",-		"child::*/child::*",-		"child::*/descendant::*",-		"child::*[2]",-		"child::article|key('key1','Carmelo Montanez')",-		"child::near-south-west",-		"child::node()",-		"child::sub",-		"child::sub1|child::sub2",-		"child[@deep='3']|child[@wide='3']",-		"child[@wide='3'] | key('one','3')",-		"child[@wide='3']|child[@deep='3']",-		"chooser",-		"comment ()",-		"concat(         substring(subj,1,number(not(starts-with(.,'Re: ')))*string-length(subj)),         substring(substring-after(subj,'Re: '),1,           		number(starts-with(.,'Re: '))*string-length(substring-after(subj,'Re: '))))",-		"concat($act,' - ',TITLE,'   ')",-		"concat($mParam,$nParam,$oParam,$pParam)",-		"concat($str,'....5....|')",-		"concat('id=', string($p2))",-		"concat(/*, /*[@attr='whatsup'])",-		"concat(a, 34)",-		"concat(a, b)",-		"concat(a, b, c, d, e)",-		"concat(false(),'ly')",-		"concat(left,right,orig)",-		"concat(left,right,orig)",-		"concat(team[1], ' versus ', team[2])",-		"concat(team[1]/@score, '-', team[2]/@score)",-		"contains(       unparsed-entity-uri('hatch-pic'),'grafix/OpenHatch.gif')",-		"contains($node,$find)",-		"contains('','')",-		"contains('ENCYCLOPEDIA', 'CYCL')",-		"contains('ENCYCLOPEDIA', 'TEST')",-		"contains('ab', 'abc')",-		"contains('abc', '')",-		"contains('abc', 'bc')",-		"contains('abc', 'bcd')",-		"contains('foo','o')",-		"contains('true()', 'e')",-		"contains(., '&amp;')",-		"contains(concat(.,'BC'),concat('A','B','C'))",-		"contains(doc, 'CYCL')",-		"contains(doc, 'TEST')",-		"contains(doc/@attr, 'TEST')",-		"contains(doc/@attr, 'amwi')",-		"contains(main,sub)",-		"contains(main,sub)",-		"contains(main,sub)",-		"contains(main,sub)",-		"count($var1)",-		"count($var2)",-		"count(*)",-		"count(*)",-		"count(*/z[2])",-		"count(.//SPEECH)",-		"count(.//comment())",-		"count(/doc/alpha[last()]/h)",-		"count(/doc/chapter/note)",-		"count(a/@*)",-		"count(a/attribute::*)",-		"count(alpha/*[last()][name()='z'])",-		"count(ancestor::section             |../ednote|following::title|../bogus)",-		"count(ancestor::section             |ancestor::simplesect|ancestor::article)",-		"count(ancestor::section           |ancestor::simplesect|ancestor::articleinfo)",-		"count(div)",-		"count(following-sibling::*)",-		"count(key('mykey', 'Introduction'))",-		"count(namespace::*)",-		"count(preceding::text())",-		"count(preceding::text())",-		"count(xalan:nodeset($rtf)/default:docelem/default:elem3)",-		"counter:read('index')",-		"counter:read('index')",-		"critter",-		"critter",-		"current()",-		"current()",-		"current()",-		"customers/customer",-		"d",-		"dat",-		"date",-		"date:getYear()",-		"day",-		"day",-		"day",-		"day",-		"day",-		"descendant-or-self::*",-		"descendant-or-self::*",-		"descendant-or-self::*[3]",-		"descendant-or-self::center",-		"descendant-or-self::far-south",-		"descendant-or-self::sub1|descendant-or-self::sub2",-		"descendant::*",-		"descendant::*",-		"descendant::*/child::*",-		"descendant::*[3]",-		"descendant::*[string-length(name(.))=1]",-		"descendant::child1|descendant::child2",-		"descendant::far-south",-		"display",-		"display",-		"display",-		"div +3",-		"div div mod",-		"div mod mod",-		"div",-		"div/@attrib div mod/@attrib",-		"div/@attrib mod mod/@attrib",-		"div/para[lang('en')]",-		"doc/element1[2]/child1[last()]",-		"document($typefile,/)",-		"document('')/*/xsl:template[@name=$whichtmplt]",-		"document('')/*/xsl:template[@name=$whichtmplt]",-		"document('')/*/xsl:template[@name='qq']/node()",-		"document('')/xsl:stylesheet/ped:test[@attrib='yeha']",-		"document('')/xsl:stylesheet/ped:test[@attrib='yeha']",-		"document('../impincl-test/mdocs11a.xml')//body",---		"document('..\mdocs\compu.xml')/market.participant/address.set/*", -- \ mag er nicht-		"document('bib.xml')",-		"document('level3/xreluri09a.xml',document('level1/level2/xreluri09b.xml'))",-		"document('mdocs01a.xml')//body",-		"document('mdocs03a.xml',section)",-		"document('select68.xml')//inside",-		"document('select68.xml')//inside",-		"document('terms.xml')",-		"document('variable20.xml')",-		"document('x14template.html')",-		"document(a)//body",-		"document(a)//body",-		"document(a)//body",-		"document(document(places))",-		"document(filename,document('level1/level2/xreluri10b.xml'))/*/body",-		"document(places)",-		"document(places)//body",-		"document(places,second)/*",-		"document(pointer/urlref/@urlstr)/market.participant/business.identity.group/business.name",-		"element",-		"element1[(((((2*10)-4)+9) div 5) mod 3 )]",-		"element1[(((((2*10)-4)+9) div 5) mod floor(3))]",-		"element1[descendant-or-self::child2]",-		"element1[floor(2)]",-		"em:foo",-		"expense-report/total",-		"expense-report/total",-		"ext:getPIData(doc/processing-instruction('a-pi'))",-		"extn1:getPIData(doc/processing-instruction('a-pi')[1])",-		"extn1:getPIData(doc/processing-instruction('b-pi'))",-		"fa/../mi | Aflat/natural/la | Csharp//* | /doc/do | *//ti",-		"false() and 1 div 0",-		"false() and false()",-		"false() and true()",-		"false() or false()",-		"false() or true()",-		"false()",-		"false()=''",-		"false()=0",-		"floor(-1.5)",-		"floor(-1.5)=-2",-		"floor(0.0)",-		"floor(1)=1",-		"floor(1.9)",-		"floor(1.9)=1",-		"floor(2.999999)",-		"floor(n0)",-		"floor(number('xxx'))",-		"following-sibling::*",-		"following-sibling::*/preceding-sibling::*",-		"following-sibling::*[1]",-		"following-sibling::*[2]/preceding-sibling::*",-		"following-sibling::*[2]/preceding-sibling::*[4]",-		"following-sibling::*[2]/preceding-sibling::*[4]/following-sibling::*[5]/preceding-sibling::*[4]/preceding-sibling::*[2]",-		"following-sibling::east",-		"following-sibling::node()",-		"following::*",-		"following::*[4]",-		"following::*[4]/../*[2]",-		"foo[(bar[2])='this']",-		"foo[(bar[2][(baz[2])='goodbye'])]",-		"format-number('foo','#############')",-		"format-number('foo','#############')",-		"format-number(-1 div 0,'###############################')",-		"format-number(-1 div 0,'###############################')",-		"format-number(-26931.4,'!!!,!!!.!!!')",-		"format-number(-26931.4,'###,###.###')",-		"format-number(-26931.4,'###,###.###','myminus')",-		"format-number(-26931.4,'###,###.###;###,###.###')",-		"format-number(-26931.4,'###.###,###','periodgroup')",-		"format-number(-26931.4,'###.###,###','periodgroup')",-		"format-number(-26931.4,'###.###,###','periodgroup')",-		"format-number(-26931.4,'###.###,###','periodgroup')",---		"format-number(-26931.4,'+!!,!!!.!!!\-!!!,!!!.!!!')", -- vom W3C auskommentiert-		"format-number(-26931.4,'+###,###.###;-###,###.###')",-		"format-number(-26931.4,'+###,###.###;_###,###.###')",-		"format-number(-26931.4,'-###,###.###')",-		"format-number(-26931.4,'-###,###.###','myminus')",-		"format-number(-26931.4,'_###,###.###','myminus')",-		"format-number(-42857.1,'###,###.###')",-		"format-number(-42857.1,'###,###.###','myminus')",-		"format-number(-42857.1,'###,###.###','myminus')",-		"format-number(-42857.1,'###,###.###','newminus')",-		"format-number(-42857.1,'###,###.###','newminus')",-		"format-number(-73816.9,'###,###.###')",-		"format-number(-73816.9,'###,###.###')",-		"format-number(-73816.9,'###,###.###')",-		"format-number(-73816.9,'###,###.###')",-		"format-number(0.25, '00%')",-		"format-number(0.4857,'###.###%')",-		"format-number(0.4857,'###.###c')",-		"format-number(0.4857,'###.###m')",-		"format-number(0.4857,'###.###‰')",-		"format-number(1 div 0,'###############################')",-		"format-number(1 div 0,'###############################')",-		"format-number(1, '#,##0')",-		"format-number(1, '00')",-		"format-number(1, '00.0')",-		"format-number(1000, '###0')",-		"format-number(1234.567,'#*###*###!###','foo:decimal1')",-		"format-number(12792.14*96.58,'##,###,000.000###')",-		"format-number(2.14*86.58,'PREFIX##00.000###SUFFIX')",-		"format-number(2392.14*(-36.58),'000,000.000###;###,###.000###')",-		"format-number(2392.14*(-36.58),'000,000.000###;-###,###.000###')",-		"format-number(2392.14*36.58,'000,000.000000')",-		"format-number(2392.14*36.58,'000,000.000000','myminus')",-		"format-number(2392.14*36.58,'000,000.000000;###,###.000###')",-		"format-number(2392.14*36.58,'000,000.000000;###,###.000###','myminus')",-		"format-number(239236.588,'00000.00')",---		"format-number(26931.4,'+!!!,!!!.!!!\-!!,!!!.!!!')", -- vom W3C auskommentiert-		"format-number(2792.14*(-36.58),'000,000.000###')",-		"format-number(4030201.0506,'#!!!,!!!,aaa.aaaaaa0')",-		"format-number(7654321.4857,'### ### ###,#####')",-		"format-number(931.4857,'###!###!###')",-		"format-number(931.4857,'000.000|###')",-		"format-number(95.4857,'¤###.####')",-		"format-number(987654321,'###,##0,00.00')",-		"generate-id(d)",-		"generate-id(xalan:nodeset($rtf)/default:docelem/default:elem4)",-		"growth",-		"growth",-		"human",-		"id('c')/@id",-		"id('c')/@id",-		"id('d b c')",-		"id('id0')/a/b",-		"id('id0')/c/c/a",-		"id('id10')/a",-		"id('id13')",-		"id('id2')/a | id('id5') | id('id15')/a",-		"id('id4')",-		"id('id8')/b/b",-		"id('id9')",-		"id('nomatch')/@id",-		"id(main/b)",-		"id(main/b)",-		"item[$n1]",-		"item[position()=$n]",-		"java:format($formatter, $date)",-		"java:format($formatter, $javadate)",-		"java:get ($counter-table, 'index')",-		"java:java.lang.Long.parseLong(string(.))",-		"java:java.text.SimpleDateFormat.new('yyyy.MM.dd hh:mm')",-		"java:java.util.Calendar.getInstance()",-		"java:java.util.Date.new($date)",-		"java:java.util.Hashtable.new ()",-		"key($keysp, 'Expressions')/subdiv/p",-		"key($keysp, 'Introduction')/subdiv/p",-		"key($keysp, 'Stylesheet Structure')/subdiv/p",-		"key('MonthNum',month)",-		"key('MonthNum',month)",-		"key('baz:mykey', 'Expressions')/p",-		"key('baz:mykey', 'Introduction')/p",-		"key('baz:mykey', 'Stylesheet Structure')/p",-		"key('bib',$lookup)",-		"key('bigspace', 'Expressions')/subdiv/p",-		"key('bigspace', 'Expressions')/subdiv/p",-		"key('bigspace', 'Introduction')/subdiv/p",-		"key('bigspace', 'Introduction')/subdiv/p",-		"key('bigspace', 'Stylesheet Structure')/subdiv/p",-		"key('bigspace', 'Stylesheet Structure')/subdiv/p",-		"key('filterspace', 'Expressions')/subdiv/p",-		"key('filterspace', 'Expressions')/subdiv/p",-		"key('filterspace', 'Introduction')/subdiv/p",-		"key('filterspace', 'Introduction')/subdiv/p",-		"key('filterspace', 'Stylesheet Structure')/subdiv/p",-		"key('filterspace', 'Stylesheet Structure')/subdiv/p",-		"key('k','Albany')",-		"key('k','Albany')",-		"key('k','false')[position()=1]/num",-		"key('k','false')[position()=2]/num",-		"key('k','true')[1]/num",-		"key('k','true')[1]/num",-		"key('k','true')[3]/num",-		"key('k','true')[3]/num",-		"key('k','true')[4]/num",-		"key('k','true')[4]/num",-		"key('k','true')[last()=position()]",-		"key('k','true')[last()]",-		"key('k','true')[position()=1]/num",-		"key('k','true')[position()=4]/num",-		"key('key1','Mary Brady')|key('key2','Rick Rivello')",-		"key('marks',key('titles', 'Expressions')/finder)",-		"key('mykey', 'Expressions')",-		"key('mykey', 'Expressions')/p",-		"key('mykey', 'Introduction')/p",-		"key('mykey', 'Patterns')",-		"key('mykey', 'Second Title in Structure')/p",-		"key('mykey', 'Stylesheet Structure')",-		"key('mykey', 'Stylesheet Structure')/p",-		"key('mykey', 1 )/p",-		"key('mykey', 1+1 )/p",-		"key('mykey', 3.0 )/p",-		"key('mykey', 3.7 )/p",-		"key('mykey',' ')/@title",-		"key('mykey','')/p",-		"key('mykey','Exp Section')/@title",-		"key('mykey','Expressions')/p",-		"key('mykey','Expressions')/p",-		"key('mykey','Intro Section')/@title",-		"key('mykey','Introduction')/p",-		"key('mykey','Introduction')/p",-		"key('mykey','SS Section')/@title",-		"key('mykey','Sort Section')/@title",-		"key('mykey','Sorting')/p",-		"key('mykey','Sorting')/p",-		"key('mykey','Stylesheet Structure')/p",-		"key('mykey','Stylesheet Structure')/p",-		"key('mykey',*//title)",-		"key('mykey1','foo' )/p",-		"key('mykey2', 1 )/p",-		"key('one','3') | key('two','3')",-		"key('smallspace', 'Expressions')/p",-		"key('smallspace', 'Expressions')/p",-		"key('smallspace', 'Introduction')/p",-		"key('smallspace', 'Introduction')/p",-		"key('smallspace', 'Stylesheet Structure')/p",-		"key('smallspace', 'Stylesheet Structure')/p",-		"key('test','foey')",-		"key('titles', .)",-		"key('two','3') | document('select59.xml')/child[@wide='3'] | child[@deep='3']",-		"key('which','3')",-		"keyword[@tag='sector']",-		"keyword[@tag='ticker']",-		"keyword[@tag='ticker']",-		"keyword[@tag='ticker']",-		"keyword[@tag='ticker']",-		"lang('en')",-		"last()",-		"local-name()",-		"local-name(.)",-		"local-name(baz1:a)",-		"local-name(baz2:b)",-		"local-name(baz2:b/@baz1:attrib2)",-		"local-name(namespace::*[1])",-		"local-name(namespace::*[string()='http://www.w3.org/1999/XMLSchema-instance'])",-		"local-name(namespace::*[string()='test'])",-		"local-name(xalan:nodeset($rtf)/*)",-		"main/a/descendant-or-self::*/@*",-		"main/size[@for='d']",-		"mi | do | fa | re",-		"mi[@mi2='mi2'] | do | fa/so/@so | fa | mi/@* | re | fa/@fa | do/@do",-		"month",-		"month",-		"month",-		"n",-		"n-2 - -n-1",-		"n-2 - n-1",-		"n-2+-n-1",-		"n0 div n1 div n2 div n3 div n4 div n5",-		"n0 div n1 div n2 div n3 div n4",-		"n0 div n1 div n2 div n3",-		"n1 div n2",-		"n1 mod n2",-		"n1*n2",-		"n1*n2*n3*n4",-		"n1*n2*n3*n4*n5*n6*n7*n8*n9*n10",-		"n1+n2",-		"n1/@attrib + n2/@attrib",-		"n1/@attrib div n2/@attrib",-		"n1/@attrib mod n2/@attrib",-		"n2+3+$anum+7+n5",-		"n4",-		"n6*5-8*n2+5*2",-		"name",-		"name",-		"name",-		"name",-		"name",-		"name",-		"name",-		"name((ancestor::section|../ednote           |following::title|../bogus)[1])",-		"name((ancestor::section|ancestor::simplesect           |ancestor::article)[last()])",-		"name(/descendant-or-self::node()/child::near-north)",-		"name(/descendant-or-self::node()/descendant-or-self::north)",-		"name(/descendant-or-self::north)",-		"name(/descendant-or-self::north/child::near-north)",-		"name(/descendant-or-self::north/descendant-or-self::north)",-		"name(/descendant::near-north)",-		"name(/descendant::near-north/descendant-or-self::near-north)",-		"name(/descendant::node()/descendant-or-self::near-north)",-		"name(ancestor::*[1])",-		"name(ancestor::*[1])",-		"name(ancestor::*[2])",-		"name(ancestor::*[2])",-		"name(ancestor::*[3])",-		"name(ancestor::*[3])",-		"name(baz1:a)",-		"name(baz1:a/@baz2:attrib1)",-		"name(baz2:b)",-		"name(baz2:b/@baz1:attrib2)",-		"name(descendant-or-self::node()/child::near-north)",-		"name(descendant-or-self::node()/child::node()/child::far-west)",-		"name(descendant-or-self::node()/child::node()/descendant-or-self::near-north)",-		"name(descendant-or-self::node()/descendant-or-self::node()/child::near-north)",-		"name(descendant-or-self::node()/descendant-or-self::node()/descendant-or-self::north)",-		"name(descendant-or-self::node()/descendant-or-self::north)",-		"name(descendant-or-self::node()/descendant::near-north)",-		"name(descendant-or-self::node()/descendant::node()/child::far-west)",-		"name(descendant-or-self::node()/descendant::node()/descendant-or-self::near-north)",-		"name(descendant-or-self::north/child::near-north)",-		"name(descendant-or-self::north/child::near-north/child::far-west)",-		"name(descendant-or-self::north/child::near-north/descendant-or-self::near-north)",-		"name(descendant-or-self::north/descendant-or-self::north)",-		"name(descendant-or-self::north/descendant-or-self::north/child::near-north)",-		"name(descendant-or-self::north/descendant-or-self::north/descendant-or-self::north)",-		"name(descendant-or-self::north/descendant::near-north)",-		"name(descendant-or-self::north/descendant::near-north/child::far-west)",-		"name(descendant-or-self::north/descendant::near-north/descendant-or-self::near-north)",-		"name(descendant::near-north/descendant-or-self::near-north)",-		"name(descendant::near-north/descendant-or-self::near-north/child::far-west)",-		"name(descendant::near-north/descendant-or-self::near-north/descendant-or-self::near-north)",-		"name(descendant::near-north/descendant::far-west)",-		"name(descendant::near-north/descendant::far-west/descendant-or-self::far-west)",-		"name(descendant::node()/descendant-or-self::near-north)",-		"name(descendant::node()/descendant-or-self::node()/child::far-west)",-		"name(descendant::node()/descendant-or-self::node()/descendant-or-self::near-north)",-		"name(descendant::node()/descendant::far-west)",-		"name(descendant::node()/descendant::node()/descendant-or-self::far-west)",-		"name(namespace::*[1])",-		"name(self::node()/descendant-or-self::node()/child::near-north)",-		"name(self::node()/descendant-or-self::node()/descendant-or-self::north)",-		"name(self::node()/descendant-or-self::north)",-		"name(self::node()/descendant-or-self::north/child::near-north)",-		"name(self::node()/descendant-or-self::north/descendant-or-self::north)",-		"name(self::node()/descendant::near-north)",-		"name(self::node()/descendant::near-north/child::far-west)",-		"name(self::node()/descendant::near-north/descendant-or-self::far-west)",-		"name(self::node()/descendant::node()/child::far-west)",-		"name(self::node()/descendant::node()/descendant-or-self::far-west)",-		"name(xalan:nodeset($rtf)/*)",-		"namespace-uri(baz1:a-two/@attrib1)",-		"namespace-uri(baz1:a/@baz2:attrib1)",-		"namespace-uri(baz2:b)",-		"namespace-uri(baz2:b-three)",-		"namespace-uri(baz2:b-three/@baz1:attrib2)",-		"namespace-uri(baz2:b-three/c-four)",-		"namespace-uri(baz2:b/@baz1:attrib2)",-		"namespace-uri(namespace::*[string()='http://www.w3.org/1999/XMLSchema-instance'])",-		"namespace-uri(namespace::*[string()='test'])",-		"namespace-uri(x)",-		"namespace-uri(xalan:nodeset($rtf)/default:docelem)",-		"namespace-uri(xalan:nodeset($rtf)/default:docelem/default:elem1)",-		"namespace-uri(xalan:nodeset($rtf)/default:docelem/test:elem3)",-		"namespace::*",-		"namespace::node()",-		"nitro:element(.)",-		"node",-		"node()|@*",-		"normalize-space($texts[1])",-		"normalize-space($thisvalue)",-		"normalize-space('	&#10;&#13;        ab           cd	&#10;&#13;       ef	&#10;&#13; ')",-		"normalize-space()",-		"normalize-space(a)",-		"north/* | north/dup1 | north/dup2",-		"north/dup2 | document('select71.xml')/south/preceding-sibling[4] | north/*",-		"north/dup2 | north/dup1 | north/*",-		"not($x!='foo')",-		"not('')",-		"not('0')",-		"not(false() = false())",-		"not(false())",-		"not(true() = false())",-		"not(true())",-		"note[1]",-		"note[1]",-		"number($ResultTreeFragTest)",-		"number($emptyResultTreeFragTest)",-		"number($pvar2)",-		"number('')",-		"number('3')",-		"number('abc')",-		"number('xxx') - 10",-		"number('xxx') div 3",-		"number('xxx') mod 3",-		"number('xxx')=0",-		"number('xxx')=number('xxx')",-		"number()",-		"number(2)",-		"number(false())=0",-		"number(foo)",-		"number(n1)",-		"number(string(1.0))=1",-		"number(true())=1",-		"number(xalan:nodeset($rtf)/default:docelem/default:elem3[2])",-		"para[@id='1' and lang('en')]",-		"parent::*",-		"parent::*[1]",-		"parent::foo",-		"parent::near-north",-		"position()",-		"position()=1",-		"preceding-sibling::*",-		"preceding-sibling::*/following-sibling::*",-		"preceding-sibling::*[2]",-		"preceding-sibling::*[2]",-		"preceding-sibling::*[2]/following-sibling::*",-		"preceding-sibling::*[2]/following-sibling::*[4]",-		"preceding-sibling::*[2]/following-sibling::*[4]/preceding-sibling::*[5]/following-sibling::*[4]/following-sibling::*[2]",-		"preceding-sibling::*|following-sibling::*",-		"preceding-sibling::child1|//child3",-		"preceding-sibling::child1|following-sibling::child3",-		"preceding-sibling::foo[1]/@att1",-		"preceding-sibling::west",-		"preceding::*",-		"preceding::*[2]/../descendant::*[10]/following-sibling::east",-		"preceding::*[2]/../following::*",-		"preceding::*[4]",-		"preceding::foo[1]/@att1",-		"preceding::out-yonder-west",-		"preceding::text()",-		"preceding::text()[$this]",-		"primary/name/first",-		"primary/name/first",-		"processing-instruction()",-		"pt:xif('test')",-		"pt:xif(string($val))",-		"round(-1.1)=-1",-		"round(-1.5)",-		"round(-1.9)=-2",-		"round(-2.5)=-2",-		"round(0.0)",-		"round(1.1)=1",-		"round(1.24)",-		"round(1.5)=2",-		"round(1.9)=2",-		"round(2.5)",-		"round(2.999999)",-		"round(count(.//LINE) div count(.//SPEECH))",-		"round(n0)",-		"round(n1)",-		"round(n2)",-		"round(number('xxx'))",-		"row",-		"self::*",-		"self::*",-		"self::*[1]",-		"self::*[@center-attr-2]",-		"self::*[near-south]",-		"self::center",-		"self::child1|self::child2",-		"self::comment()",-		"self::foo",-		"self::node()",-		"self::node()",-		"self::node()",-		"self::node()",-		"self::processing-instruction()",-		"self::text()",-		"sigs",-		"sss//i",-		"sss//i",-		"sss/sss",-		"sss/sss",-		"starts-with('','')",-		"starts-with('ENCYCLOPEDIA', 'EN')",-		"starts-with('ENCYCLOPEDIA', 'ENCY')",-		"starts-with('ENCYCLOPEDIA', 'en')",-		"starts-with('ab', 'abc')",-		"starts-with('abc', '')",-		"starts-with('abc', 'bc')",-		"starts-with('true()', 'tr')",-		"starts-with(doc, 'ENCY')",-		"starts-with(doc, 'test')",-		"starts-with(doc/@attr, 'slam')",-		"starts-with(doc/@attr, 'wich')",-		"str:new(string(doc))",-		"str:toUpperCase($str-obj)",-		"string($ResultTreeFragTest)",-		"string($ResultTreeFragTest)",-		"string($emptyResultTreeFragTest)",-		"string($which)",-		"string('!From m!')",-		"string('!From n!')",-		"string('!From o!')",-		"string('!From p!')",-		"string('')",-		"string('test')",-		"string()",-		"string()",-		"string(0)",-		"string(2)",-		"string(av//*)",-		"string(doc)",-		"string(foo)",-		"string-length ()",-		"string-length($str)",-		"string-length('This is a test')",-		"string-length()",-		"string-length()",-		"string-length(.)",-		"string-length(doc)",-		"string-length(doc/a)",-		"sub1/child1|/doc/sub2/child2",-		"sub1/child1|sub2/child2",-		"subj",-		"substring('1999/04/01', 1, 0)",-		"substring('1999/04/01', 1, 4)",-		"substring('ENCYCLOPEDIA', 8)",-		"substring('ENCYCLOPEDIA', 8, 3)",-		"substring('abcdefghi',2,4)",-		"substring('abcdefghijk',0 div 0, 5)",-		"substring('abcdefghijk',4, 6)",-		"substring(@key,2,1)",-		"substring(doc, 1, 4)",-		"substring(doc/@attr, 1, 3)",-		"substring(doc/@attr, 2.5, 3.6)",-		"substring(doc/@attr, 4)",-		"substring(foo, 12, 3)",-		"substring(foo, 2, 2)",-		"substring-after($words,' ')",-		"substring-after('1999/04/01', '/')",-		"substring-after('1999/04/01', '1')",-		"substring-after('ENCYCLOPEDIA', '/')",-		"substring-after('ENCYCLOPEDIA', 'C')",-		"substring-after('abcdefghijk','l')",-		"substring-after(doc, '/')",-		"substring-after(doc/@attr, 'D')",-		"substring-after(doc/@attr, 'd')",-		"substring-after(doc/@attr, 'z')",-		"substring-after(foo, '/')",-		"substring-before('1999/04/01', '/')",-		"substring-before('ENCYCLOPEDIA', '/')",-		"substring-before('ENCYCLOPEDIA', 'C')",-		"substring-before('ENCYCLOPEDIA', 'c')",-		"substring-before('a','z')",-		"substring-before(doc, '/')",-		"substring-before(doc/@attr, 'D')",-		"substring-before(doc/@attr, 'd')",-		"substring-before(doc/@attr, 'z')",-		"substring-before(foo, '/')",-		"sum($rtf)",-		"sum(e)",-		"sum(e)",-		"sum(n)",-		"sum(n/@attrib)",-		"sum(x)",-		"sum(xalan:nodeset($rtf)/default:docelem/default:elem3)",-		"system-property('xsl:vendor')",-		"true() and false()",-		"true() and true()",-		"true() or 1 div 0",-		"true() or false()",-		"true() or true()",-		"true()",-		"true()=2",-		"width * depth",-		"xalan:nodeset($rtf)/default:docelem",-		"xalan:nodeset($rtf)/default:docelem/*",-		"xalan:nodeset($rtf)/default:docelem/default:elem1",-		"xalan:nodeset($rtf)/default:docelem/default:elem1/default:elem1b",-		"xalan:nodeset($rtf)/default:docelem/default:elem2/*",-		"xalan:nodeset($rtf)/default:docelem/default:elem4",-		"xalan:nodeset($rtf)/default:docelem/test:elem3",-		"xalan:nodeset($sorted)/item",-	    "deep-equal(/,foo)"-	]----- die folgenden tests wurden vom W3C auskommentiert--- ab hier ersetzen alle ersten -- durch <--- <!-- arg value="concat(&quot;a&quot;,&quot;b&quot;,&quot;c&quot;,&quot;d&quot;,&quot;ef&quot;)"/ -->--- <!-- arg value="concat(&quot;bc&quot;, string(23))"/>--- <test value="concat(&quot;cd&quot;, &quot;34&quot;)"/>--- <test value="concat(&quot;cd&quot;, 34)"/>--- <test value="concat(&quot;x&quot;,&quot;yz&quot;)"/ -->---- <!-- arg value="document(&quot;&quot;)//bdd:test"/>--- <test value="document(&quot;&quot;)//ped:test"/>--- <test value="document(&quot;&quot;)/xsl:stylesheet/ped:test[@attrib=&quot;yeha&quot;]"/>--- <test value="document(&quot;../impincl-test/mdocstest.xml&quot;)//a"/>--- <test value="document(&quot;../impincl-test/mdocstest.xml&quot;)//b"/ -->---- <!-- arg value="substring(&quot;12345&quot;, -1 div 0, 1 div 0)"/>--- <test value="substring(&quot;12345&quot;, -42, 1 div 0)"/>--- <test value="substring(&quot;12345&quot;, 0 div 0, 3)"/>--- <test value="substring(&quot;12345&quot;, 0, 3)"/>--- <test value="substring(&quot;12345&quot;, 1, 0 div 0)"/>--- <test value="substring(&quot;12345&quot;, 1.5, 2.6)"/ -->---- <!-- arg value="translate(&quot;B'B&quot;,&quot;'&quot;,&quot;`&quot;)"/>--- <test value="translate(&quot;BAR&quot;,&quot;Rab&quot;,&quot;TxX&quot;)"/>--- <test value="translate(&quot;BAR&quot;,&quot;abc&quot;,&quot;ABC&quot;)"/>--- <test value="translate(&quot;bar&quot;,&quot;RAB&quot;,&quot;xyz&quot;)"/>--- <test value="translate(&quot;bar&quot;,&quot;abc&quot;,&quot;ABC&quot;)"/>--- <test value="translate(&quot;ddaaadddd&quot;,&quot;abcd&quot;,&quot;ABCxy&quot;)"/>--- <test value="translate(&quot;zzaaazzz&quot;,&quot;abcz&quot;,&quot;ABC&quot;)"/>--- <test value="translate(.,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>--- <test value="translate(a,&quot;abc&quot;,&quot;ABC&quot;)"/>--- <test value="translate(a/@attrib,&quot;lo&quot;,&quot;IT&quot;)"/>--- <test value="translate(b,&quot;ABC&quot;,&quot;abc&quot;)"/>--- <test value="translate(b/@attrib,&quot;LO&quot;,&quot;it&quot;)"/>--- <test value="translate(b/@attrib,&quot;lo&quot;,&quot;it&quot;)"/>--- <test value="translate(normalize-space($s), &quot; &quot;, &quot;_&quot;)"/ -->
− examples/arrows/hxpath/XPathShell.hs
@@ -1,185 +0,0 @@--- --------------------------------------------------------------{- |-   Module     : XPathShell-   Copyright  : Copyright (C) 2008 Uwe Schmidt-   License    : MIT--   Maintainer : Uwe Schmidt (uwe@fh-wedel.de)-   Stability  : experimental-   Portability: portable--   XPath example program for testing xpath evaluation-   with both evaluation stategies, the full XPath functionality-   and the limited but faster one for simple XPath queries---}---- ---------------------------------------------------------------module Main-where--import qualified Control.Monad as M--import Text.XML.HXT.Arrow--import qualified-       Text.XML.HXT.Arrow.XPathSimple as XPS--import Text.XML.HXT.XPath.XPathParser-    ( parseXPath-    )--import System.Console.Editline.Readline-import System.Environment--import Text.ParserCombinators.Parsec-    ( runParser )--type NsEnv'	= AssocList String String--main	:: IO()-main-    = do-      args <- getArgs-      (path, env, doc) <- evalArgs args-      if not (null path) && not (null doc)-	 then evalXPath path env (head doc)-	 else evalLoop env doc--evalArgs			:: [String] -> IO (String, NsEnv', XmlTrees)-evalArgs []			= evalArgs (""   : "[]" : ""  : [])-evalArgs [doc]			= evalArgs (""   : "[]" : doc : [])-evalArgs [path, doc]		= evalArgs (path : "[]" : doc : [])-evalArgs [path, env, ""]	= return (path, buildEnv env, [])-evalArgs [path, env, doc]	= do-				  (d, ne) <- loadDoc doc-				  return (path, addEntries ne . buildEnv $ env, d)-evalArgs al			= evalArgs (take 3 al)--buildEnv			:: String -> NsEnv'-buildEnv env			= (addEntries . read $ env) $ defaultEnv--loadDoc		:: String -> IO ([XmlTree], NsEnv')-loadDoc doc-    = do-      d <- runX ( readDocument [ (a_tagsoup, v_0)-			       , (a_parse_by_mimetype, v_1)-			       , (a_check_namespaces, v_1)-			       , (a_remove_whitespace, v_1)-			       , (a_validate, v_0)-			       , (a_canonicalize, v_1)-			       ] doc-		  >>>-		  (documentStatusOk `guards` this)-		)-      let env = runLA (unlistA >>> collectNamespaceDecl) d-      return (d, env)--showDoc		:: XmlTree -> IO ()-showDoc doc-    = runX ( constA doc-	     >>>-	     writeDocument [ (a_indent, v_1)-			   , (a_no_xml_pi, v_1)-			   ] ""-	   )-      >> return ()--showTree		:: XmlTree -> IO ()-showTree doc-    = runX ( constA doc-	     >>>-	     writeDocument [ (a_show_tree, v_1)-			   , (a_no_xml_pi, v_1)-			   ] ""-	   )-      >> return ()--evalXPath	:: String -> NsEnv' -> XmlTree -> IO()-evalXPath path env doc-    | nr == xr-	= putStrLn . unlines $ "ok: " : nr-    | otherwise-	= do-	  putStrLn . unlines $-		       [ "results differ"-		       , "expected: "-		       ] ++ xr ++-		       [ "got:      "-		       ] ++ nr-	  putStrLn $ xpt path-    where-    xpt = either show show . runParser parseXPath (toNsEnv env) ""-    nr = runLA (XPS.getXPathTreesWithNsEnv env path >>> xshow this) doc-    xr = runLA (    getXPathTreesWithNsEnv env path >>> xshow this) doc--evalLoop	:: NsEnv' -> XmlTrees -> IO ()-evalLoop env doc-    = do-      maybeLine <- readline "xpath> "-      case maybeLine of -        Nothing	-> return () -- EOF / control-d-	Just ":q"	-> return ()-	Just line -> do-		     let ws = words line-		     if null ws-			then evalLoop env doc-			else do-			     addHistory line-			     evalCmd (words line)-    where-    evalCmd []		= evalLoop env doc-    evalCmd [":ns",uri]	= evalCmd [":ns", "", uri]-    evalCmd [":ns", ns, uri]-			= evalLoop (addEntry ns uri env) doc-    evalCmd (":?":_)	= do-			  putStrLn . unlines $-				       [ "XPath Tester"-				       , "Commands:"-				       , ":l <document>\tload a document"-				       , ":ns <uri>\tset default namespace"-				       , ":ns <px> <uri>\tset namespace"-				       , ":q\t\tquit"-				       , ":s\t\tshow current document"-				       , ":t\t\tshow current document in tree format"-				       , ":x\t\tshow current namespace environment"-				       , ":?\t\tthis message"-				       , "<xpath-expr>\tevaluate XPath expression"-				       ]-			  evalLoop env doc-    evalCmd [":x"]	= do-			  putStrLn . unlines . map show $ env-			  evalLoop env doc-    evalCmd [":s"]	= do-			  M.when (not . null $ doc) (showDoc . head $ doc)-			  evalLoop env doc-    evalCmd [":t"]	= do-			  M.when (not . null $ doc) (showTree . head $ doc)-			  evalLoop env doc-    evalCmd [":l",n]	= do-			  (nd, nv) <- loadDoc n-			  if null nd-			     then do-				  putStrLn ("error when loading " ++ show n)-				  evalLoop env doc-			     else evalLoop (addEntries nv env) nd-    evalCmd ws@((':':_):_)-			= do-			  putStrLn ("unknown command (:? for help): " ++ (show . unwords $ ws))-			  evalLoop env doc-    evalCmd ws		= do-			  let path = unwords ws-			  if null doc-			     then putStrLn "no document loaded"-			     else evalXPath path env (head doc)-			  evalLoop env doc--defaultEnv		:: NsEnv'-defaultEnv		= [ ("xml",xmlNamespace)-			  , ("xmlns",xmlnsNamespace)-			  ]---- ----------------------------------------
− examples/arrows/hxpath/example1.xml
@@ -1,27 +0,0 @@-<?xml version="1.0"?>--<!DOCTYPE rezept [-<!ATTLIST rezept  xml:lang  CDATA  #IMPLIED>-<!ELEMENT rezept  (zutat*, anleitung*)>-<!ELEMENT zutat  (#PCDATA)>-<!ATTLIST zutat  id ID #IMPLIED>-<!ATTLIST zutat  xml:lang  CDATA  #IMPLIED>-<!ATTLIST zutat  xmlns:xlink  CDATA  #IMPLIED>-<!ATTLIST zutat  xlink:type  CDATA  #IMPLIED>-<!ATTLIST zutat  xlink:href  CDATA  #IMPLIED>-<!ELEMENT anleitung (#PCDATA)>-]>--<?xml-stylesheet href="style.xsl" type="text/xml"?>-<rezept>-   <zutat id="mehl">200g Mehl</zutat>-   <zutat id="mehl">z 2</zutat>-   <zutat id="mehl">z 3</zutat>-   <!-- weitere Zutaten -->-   <anleitung>-      Zuerst nehmen Sie das-      <zutat xmlns:xlink="http://www.w3.org/1999/xlink"-             xlink:type="simple" xlink:href="mehl">Mehl</zutat>-      und mischen es mit ...-   </anleitung>-</rezept>
hxt.cabal view
@@ -1,13 +1,13 @@ -- arch-tag: Haskell XML Toolbox main description file name: hxt-version: 8.4.1+version: 8.5.0 license: OtherLicense license-file: LICENCE maintainer: Uwe Schmidt <uwe@fh-wedel.de> stability: stable category: XML synopsis: A collection of tools for processing XML with Haskell. -description:  The Haskell XML Toolbox bases on the ideas of HaXml and HXML, but introduces a more general approach for processing XML with Haskell. The Haskell XML Toolbox uses a generic data model for representing XML documents, including the DTD subset and the document subset, in Haskell. It contains a validating XML parser, a HTML parser, namespace support, an XPath expression evaluator, an XSLT library, a RelaxNG schema validator and funtions for serialization and deserialization of user defined data. The libraray make extensive use of the arrow approach for processing XML.+description:  The Haskell XML Toolbox bases on the ideas of HaXml and HXML, but introduces a more general approach for processing XML with Haskell. The Haskell XML Toolbox uses a generic data model for representing XML documents, including the DTD subset and the document subset, in Haskell. It contains a validating XML parser, a HTML parser, namespace support, an XPath expression evaluator, an XSLT library, a RelaxNG schema validator and funtions for serialization and deserialization of user defined data. The library make extensive use of the arrow approach for processing XML. Since version 8.5 XPath and XSLT have been moved to separate packages hxt-xpath and hxt-xslt. homepage: http://www.fh-wedel.de/~si/HXmlToolbox/index.html copyright: Copyright (c) 2005-2010 Uwe Schmidt build-type: Simple@@ -56,12 +56,6 @@  examples/arrows/hrelaxng/valid1.xml  examples/arrows/hrelaxng/valid2.rng  examples/arrows/hrelaxng/valid2.xml- examples/arrows/hxpath/example1.xml- examples/arrows/hxpath/.ghci- examples/arrows/hxpath/HXPath.hs- examples/arrows/hxpath/Makefile- examples/arrows/hxpath/W3CTestData.hs- examples/arrows/hxpath/XPathShell.hs  examples/arrows/performance/GenDoc.hs  examples/arrows/performance/Makefile  examples/arrows/pickle/Makefile@@ -85,7 +79,6 @@   Data.AssocList,   Data.Atom,   Data.Char.UTF8,-  Data.NavTree,   Data.Tree.Class,   Data.Tree.NTree.TypeDefs,   Text.XML.HXT.Arrow,@@ -103,8 +96,6 @@   Text.XML.HXT.Arrow.ProcessDocument,   Text.XML.HXT.Arrow.ReadDocument,   Text.XML.HXT.Arrow.WriteDocument,-  Text.XML.HXT.Arrow.XPath,-  Text.XML.HXT.Arrow.XPathSimple,   Text.XML.HXT.Arrow.XmlArrow,   Text.XML.HXT.Arrow.XmlIOStateArrow,   Text.XML.HXT.Arrow.XmlRegex,@@ -164,17 +155,7 @@   Text.XML.HXT.RelaxNG.XmlSchema.Regex,   Text.XML.HXT.RelaxNG.XmlSchema.RegexMatch,   Text.XML.HXT.RelaxNG.XmlSchema.RegexParser,-  Text.XML.HXT.Version,-  Text.XML.HXT.XPath,-  Text.XML.HXT.XPath.NavTree,-  Text.XML.HXT.XPath.XPathArithmetic,-  Text.XML.HXT.XPath.XPathDataTypes,-  Text.XML.HXT.XPath.XPathEval,-  Text.XML.HXT.XPath.XPathFct,-  Text.XML.HXT.XPath.XPathKeywords,-  Text.XML.HXT.XPath.XPathParser,-  Text.XML.HXT.XPath.XPathToNodeSet,-  Text.XML.HXT.XPath.XPathToString+  Text.XML.HXT.Version   hs-source-dirs: src @@ -192,5 +173,5 @@                 network    >= 2.1 && < 3,                 deepseq    >= 1.1 && < 2,                 bytestring >= 0.9 && < 1,-                tagsoup    >= 0.8 && < 1,+                tagsoup    >= 0.8 && < 0.9,                 curl       >= 1.3 && < 2
− src/Data/NavTree.hs
@@ -1,116 +0,0 @@--- |--- Navigable tree structure which allow a program to traverse--- up the tree as well as down.--- copied and modified from HXML (<http://www.flightlab.com/~joe/hxml/>)-----module Data.NavTree-    ( module Data.NavTree-    , module Data.Tree.NTree.TypeDefs-    )-where--import Data.Tree.NTree.TypeDefs---- --------------------------------------------------------------------------------- NavTree------ | navigable tree with nodes of type node------ a navigable tree consists of a n-ary tree for the current fragment tree,--- a navigable tree for all ancestors, and two n-ary trees for--- the previous- and following siblings--data NavTree a = NT-    (NTree a)		-- self-    [NavTree a]		-- ancestors-    [NTree a]		-- previous siblings (in reverse order)-    [NTree a]		-- following siblings-	deriving (Show, Eq, Ord)----- ---------------------------------------------------------------------------------- |--- converts a n-ary tree in a navigable tree--ntree	:: NTree a -> NavTree a-ntree nd-    = NT nd [] [] []---- |--- converts a navigable tree in a n-ary tree--subtreeNT	:: NavTree a -> NTree a-subtreeNT (NT nd _ _ _)-    = nd----- |--- function for selecting the value of the current fragment tree--dataNT	:: NavTree a -> a-dataNT (NT (NTree a _) _ _ _)-    = a----- --------------------------------------------------------------------------------- functions for traversing up, down, left and right in a navigable tree--upNT- , downNT- , leftNT- , rightNT :: NavTree a -> Maybe (NavTree a)--upNT	  (NT _ (p:_) _ _)		= Just p-upNT	  (NT _ [] _ _) 		= Nothing-downNT	t@(NT (NTree _ (c:cs)) u _ _)	= Just (NT c (t:u) [] cs)-downNT 	  (NT (NTree _ []    ) _ _ _)	= Nothing-leftNT	  (NT s u (l:ls) r)		= Just (NT l u ls (s:r))-leftNT	  (NT _ _ []     _)		= Nothing-rightNT   (NT s u l (r:rs))		= Just (NT r u (s:l) rs)-rightNT   (NT _ _ _ []    ) 		= Nothing----- preorderNT t = t : concatMap preorderNT (children t)--- where children = maybe [] (maybeStar rightNT) . downNT--preorderNT	:: NavTree a -> [NavTree a]-preorderNT-    = visit []-    where-    visit  k t = t : maybe k (visit' k) (downNT t)-    visit' k t = visit (maybe k (visit' k) (rightNT t)) t--revPreorderNT	:: NavTree a -> [NavTree a]-revPreorderNT t-    = t : concatMap revPreorderNT (reverse (children t))-      where-      children = maybe [] (maybeStar rightNT) . downNT--getChildrenNT	:: NavTree a -> [NavTree a]-getChildrenNT node-    = maybe [] follow (downNT node)-      where-      follow n = n : maybe [] follow (rightNT n)---- -------------------------------------------------------------------------------- Miscellaneous useful combinators---- |--- Kleisli composition:--o' :: (Monad m) => (b -> m c) -> (a -> m b) -> (a -> m c)-f `o'` g = \x -> g x >>= f----- Some useful anamorphisms:--maybeStar, maybePlus :: (a -> Maybe a) -> a -> [a]-maybeStar f a = a : maybe [] (maybeStar f) (f a)-maybePlus f a =     maybe [] (maybeStar f) (f a)---- -----------------------------------------------------------------------------
src/Text/XML/HXT/Arrow.hs view
@@ -26,7 +26,6 @@      , module Text.XML.HXT.Arrow.XmlArrow     , module Text.XML.HXT.Arrow.XmlIOStateArrow-    , module Text.XML.HXT.Arrow.XPath      , module Text.XML.HXT.Arrow.DocumentInput     , module Text.XML.HXT.Arrow.DocumentOutput@@ -59,9 +58,6 @@ import Text.XML.HXT.Arrow.XmlArrow import Text.XML.HXT.Arrow.XmlIOStateArrow import Text.XML.HXT.Arrow.XmlRegex ()		-- import this explicitly-import Text.XML.HXT.Arrow.XPath--import Text.XML.HXT.Arrow.XPathSimple ()	-- import this explicitly  import Text.XML.HXT.Version 
− src/Text/XML/HXT/Arrow/XPath.hs
@@ -1,287 +0,0 @@--- --------------------------------------------------------------{- |-   Module     : Text.XML.HXT.Arrow.XPath-   Copyright  : Copyright (C) 2006 Uwe Schmidt-   License    : MIT--   Maintainer : Uwe Schmidt (uwe@fh-wedel.de)-   Stability  : experimental-   Portability: portable--   Arrows for working with XPath and XmlNodeSets.--   Most of the XPath arrows come in two versions,-   one without dealing with namespaces, element and attribute names-   in XPath expressions are taken as they ar ignoring any prefix:localname structure.--   The second variant uses a namespace environment for associating the right-   namespace for the appropriate prefix. an entry for the empty prefix-   defines the default namespace for the expression.--   The second variant should be used, when in the application namespaces-   are significant, that means when namespace propagation is done for-   the documents to be processed.--   NodeSets are sets of \"pointer\" into an XML tree to reference-   subnodes. These nodesets can be computed by XPath expressions or-   normal arrows. The nodesets can then be used later for selecting-   or modifying subtrees of this tree in an efficient way.---}---- --------------------------------------------------------------module Text.XML.HXT.Arrow.XPath-    ( getXPathTreesInDoc-    , getXPathTreesInDocWithNsEnv-    , getXPathTrees-    , getXPathTreesWithNsEnv-    , getElemNodeSet-    , getElemAndAttrNodeSet-    , getXPathNodeSet-    , getFromNodeSet-    , processXPathTrees-    , processXPathTreesWithNsEnv-    , processFromNodeSet-    )-where--import qualified Text.XML.HXT.XPath as PT-    ( getXPathSubTreesWithNsEnv-    , getXPathNodeSetWithNsEnv-    )--import Control.Arrow.ListArrows--import Text.XML.HXT.DOM.Interface-import Text.XML.HXT.Arrow.XmlArrow--import Text.XML.HXT.Arrow.Edit-    ( canonicalizeForXPath-    )---- ---------------------------------------------------------------- |--- Select parts of a whole XML document with root node by a XPath expression.------ The main filter for selecting parts of a document via XPath.------ The string argument must be a XPath expression with an absolute location path,--- the argument tree must be a complete document tree.------ Before evaluating the xpath query, the document is canonicalized--- with 'Text.XML.HXT.Arrow.Edit.canonicalizeForXPath'------ Result is a possibly empty list of XmlTrees forming the set of selected XPath values.--- XPath values other than XmlTrees (numbers, attributes, tagnames, ...)--- are convertet to text nodes.--getXPathTreesInDoc			:: ArrowXml a => String -> a XmlTree XmlTree-getXPathTreesInDoc			= getXPathTreesInDocWithNsEnv []---- | Same as 'getXPathTreesInDoc' but with namespace environment for the XPath names--getXPathTreesInDocWithNsEnv		:: ArrowXml a => Attributes -> String -> a XmlTree XmlTree-getXPathTreesInDocWithNsEnv env query	= canonicalizeForXPath-					  >>>-					  arrL (PT.getXPathSubTreesWithNsEnv env query)---- |--- Select parts of an arbitrary XML tree by a XPath expression.------ The main filter for selecting parts of an arbitrary XML tree via XPath.--- The string argument must be a XPath expression with an absolute location path,--- There are no restrictions on the argument tree.------ No canonicalization is performed before evaluating the query------ Result is a possibly empty list of XmlTrees forming the set of selected XPath values.--- XPath values other than XmlTrees (numbers, attributes, tagnames, ...)--- are convertet to text nodes.--getXPathTrees				:: ArrowXml a => String -> a XmlTree XmlTree-getXPathTrees				= getXPathTreesWithNsEnv []---- | Same as 'getXPathTrees' but with namespace environment for the XPath names--getXPathTreesWithNsEnv			:: ArrowXml a => Attributes -> String -> a XmlTree XmlTree-getXPathTreesWithNsEnv env query	= arrL (PT.getXPathSubTreesWithNsEnv env query)---- | Select a set of nodes via an XPath expression from an arbitray XML tree------ The result is a set of \"pointers\" to nodes. This set can be used to--- access or modify the values of the subnodes in subsequent calls to 'getFromNodeSet' or 'processFromNodeSet'.------ This function enables for parsing an XPath expressions and traversing the tree for node selection once--- and reuse this result possibly many times for later selection and modification operations.--getXPathNodeSet				:: ArrowXml a => String -> a XmlTree XmlNodeSet-getXPathNodeSet				= getXPathNodeSetWithNsEnv []---- | Same as 'getXPathNodeSet' but with namespace environment for the XPath names--getXPathNodeSetWithNsEnv		:: ArrowXml a => Attributes -> String -> a XmlTree XmlNodeSet-getXPathNodeSetWithNsEnv nsEnv query	= arr (PT.getXPathNodeSetWithNsEnv nsEnv query)---- --------------------------------------------------------------getNodeSet	:: ArrowXml a => a XmlTree QName -> a XmlTree XmlTree -> a XmlTree XmlNodeSet-getNodeSet af f-    = ( ( listA ( getChildren-		  >>>-		  getNodeSet af f-		)-	  >>>-	  arr filterNodeSet-	)-	&&&-	listA af-	&&&-	listA f-      )-      >>^ (\ ~(cl, (al, n)) -> XNS (not . null $ n) al cl)-    where-    filterNodeSet	:: [XmlNodeSet] -> ChildNodes-    filterNodeSet-	= concat . zipWith filterIx [0..]--    filterIx	:: Int -> XmlNodeSet -> ChildNodes-    filterIx _ix (XNS False [] [])-	= []-    filterIx ix ps-	= [(ix, ps)]---- |--- compute a node set from a tree, containing all nodes selected by the predicate arrow------ computation of the set of element nodes with name \"a\" is done with------ > getElemNodeSet (hasName "a")--getElemNodeSet		:: ArrowXml a => a XmlTree XmlTree -> a XmlTree XmlNodeSet-getElemNodeSet f-    = getNodeSet none f---- |--- compute a node set from a tree, containing all nodes including attribute nodes--- elected by the predicate arrow--getElemAndAttrNodeSet	:: ArrowXml a => a XmlTree XmlTree -> a XmlTree XmlNodeSet-getElemAndAttrNodeSet f-    = getNodeSet ( getAttrl-		   >>>-		   ( f `guards` getAttrName )-		 ) f---- ---------------------------------------------------------------- |--- select all subtrees specified by a previously computed node set------ the following law holds:------ > getFromNodeSet $< getElemNodeSet f == multi f--getFromNodeSet		:: ArrowXml a => XmlNodeSet -> a XmlTree XmlTree-getFromNodeSet (XNS t al cl)-    = fromLA $-      ( if t then this else none )-      <+>-      ( getAttrl >>> getFromAttrl al )-      <+>-      ( getFromChildren (0-1) cl $< listA getChildren )-    where--    getFromAttrl	:: [QName] -> LA XmlTree XmlTree-    getFromAttrl l-	= ( catA . map hasQName $ l)-	  `guards`-	  this--    getFromChildren	:: Int -> ChildNodes -> XmlTrees -> LA XmlTree XmlTree-    getFromChildren _ [] _-	= none--    getFromChildren i' ((i, sp) : sps) ts-	= ( arrL (const t') >>> getFromNodeSet sp )-	  <+>-	  getFromChildren i sps ts'-	  where-	  (t', ts') = splitAt 1 . drop (i-i'-1) $ ts---- ---------------------------------------------------------------- |--- process all subtrees selected by an XPath expression------ the following law holds:------ > processXPathTrees p xpathExpr == processFromNodeSet p $< getXPathNodeSet xpathExpr---processXPathTrees		:: ArrowXml a => a XmlTree XmlTree  -> String -> a XmlTree XmlTree-processXPathTrees f		= processXPathTreesWithNsEnv f []---- | Same as 'processXPathTrees' but with namespace environment for the XPath names--processXPathTreesWithNsEnv	:: ArrowXml a => a XmlTree XmlTree  -> Attributes -> String -> a XmlTree XmlTree-processXPathTreesWithNsEnv f nsEnv query-    = choiceA-      [ isRoot :-> processChildren pns-      , this   :-> pns-      ]-    where-    pns = processFromNodeSet f $< getXPathNodeSetWithNsEnv nsEnv query---- |--- process all subtrees specified by a previously computed node set in bottom up manner------ the follwoing law holds:------ > processFromNodeSet g $< getElemNodeSet f == processBottomUp (g `when` f)------ when attributes are contained in the node set (see 'getElemAndAttrNodeSet'), these are processed--- after the children and before the node itself------ the advantage of processFromNodeSet is the separation of the selection of set of nodes to be processed (e.g. modified)--- from the real proccessing. The selection sometimes can be done once, the processing possibly many times.--processFromNodeSet	:: ArrowXml a => a XmlTree XmlTree  -> XmlNodeSet -> a XmlTree XmlTree-processFromNodeSet f (XNS t al cl)-    = ( if null cl-	then this-	else replaceChildren ( processC (0-1) cl $< listA getChildren )-      )-      >>>-      ( if null al-	then this-	else processAttrl (processA al)-      )-      >>>-      ( if not t-	then this-	else f-      )-    where--    -- processA		:: ChildNodes -> a XmlTree XmlTree-    processA l-	= f `when` ( catA . map hasQName $ l)--    -- processC		:: ChildNodes -> XmlTrees -> a XmlTree XmlTree-    processC _ [] ts-	= arrL (const ts)--    processC i' ((i, sp) : sps) ts-	= arrL (const ts1)-	  <+>-	  ( arrL (const ti) >>> processFromNodeSet f sp)-	  <+>-	  processC i sps ts21-	  where-	  (ts1, ts2) = splitAt (i-i'-1) ts-	  (ti, ts21) = splitAt 1 ts2---- ------------------------------------------------------------
− src/Text/XML/HXT/Arrow/XPathSimple.hs
@@ -1,507 +0,0 @@--- --------------------------------------------------------------{- |-   Module     : Text.XML.HXT.XPath.GetSimpleXPath-   Copyright  : Copyright (C) 2008 Uwe Schmidt-   License    : MIT--   Maintainer : Uwe Schmidt (uwe@fh-wedel.de)-   Stability  : experimental-   Portability: portable--   XPath selection for simple XPath expressions with list arrows-   instead of navigable trees.--   It is recommended, that this module is imported qualified,-   e.g like @Text.XML.HXT.Arrow.XPathSimple as XS@.--   The arrows defined in this module have the same-   functionality as the functions in 'Text.XML.HXT.Arrow.XPath'.--   The computation model in XPath is a navigable tree,-   that means a tree which can be traversed in arbitrary directions,-   not only from the root to the leafs. Sometimes this model-   leads to inefficient XPath processing for simple queries, which-   only need a top down tree traversal.--   When evaluating an XPath expression with these functions, first an attempt is made-   to map the XPath expression to a pure arrow. If this is possible-   due to the simplicity of the XPath expressions, the result is computed-   directly, else the query is processed by the corresponding-   function in 'Text.XML.HXT.Arrow.XPath'.--   The simple evaluation is possible, when in the XPath expression-   only the top down axes (self, child, descendant, descendant or self) are used,-   when no built-in functions concerning the position of a node are used,-   and no comparison of nodes e.g. in node set union is required.---}---- --------------------------------------------------------------module Text.XML.HXT.Arrow.XPathSimple-where---- import qualified Debug.Trace as T--import Control.Monad-import Control.Arrow.ListArrows--import Data.Maybe--import Text.ParserCombinators.Parsec		( runParser )--import Text.XML.HXT.DOM.Interface-import Text.XML.HXT.Arrow.XmlArrow--import qualified Text.XML.HXT.Arrow.XPath as XP	( getXPathTreesWithNsEnv-						)-import Text.XML.HXT.Arrow.Edit			( canonicalizeForXPath-						)--import Text.XML.HXT.XPath.XPathDataTypes	( XPNumber (..)-						, Expr (..)-						, Op (..)-						, XPathNode (..)-						, LocationPath (..)-						, Path (..)-						, XStep (..)-						, AxisSpec (..)-						, NodeTest (..)-						, XPathValue (..)-						)-import Text.XML.HXT.XPath.XPathParser		( parseXPath-						, parseNumber-						)---- -------------------------------------------- |--- Same Functionality as 'Text.XML.HXT.Arrow.XPath.getXPathTreesInDoc'--getXPathTreesInDoc			:: ArrowXml a => String -> a XmlTree XmlTree-getXPathTreesInDoc			= getXPathTreesInDocWithNsEnv []---- |--- Same Functionality as 'Text.XML.HXT.Arrow.XPath.getXPathTreesInDocWithNsEnv'--getXPathTreesInDocWithNsEnv		:: ArrowXml a => Attributes -> String -> a XmlTree XmlTree-getXPathTreesInDocWithNsEnv env query	= canonicalizeForXPath-					  >>>-					  tryGetXPath env query--- |--- Same Functionality as 'Text.XML.HXT.Arrow.XPath.getXPathTrees'--getXPathTrees				:: ArrowXml a => String -> a XmlTree XmlTree-getXPathTrees				= getXPathTreesWithNsEnv []---- |--- Same Functionality as 'Text.XML.HXT.Arrow.XPath.getXPathTreesWithNsEnv'--getXPathTreesWithNsEnv			:: ArrowXml a => Attributes -> String -> a XmlTree XmlTree-getXPathTreesWithNsEnv			= tryGetXPath---tryGetXPath				:: ArrowXml a => Attributes -> String -> a XmlTree XmlTree-tryGetXPath env query			= ( listA (getXPathTreesWithNsEnvSimple env query)-					    &&&-					    listA (   XP.getXPathTreesWithNsEnv env query)-					  )-                                          >>>-					  ifA (arr fst >>> (unlistA >>. take 1) >>> isError)-					      (arr snd >>> unlistA)-					      (arr fst >>> unlistA)---- |--- The xpath interpreter for simple xpath expressions.------ In case of a too complicated or illegal xpath expression an error--- node is returned, else the list of selected XML trees--getXPathTreesWithNsEnvSimple		:: ArrowXml a => Attributes -> String -> a XmlTree XmlTree-getXPathTreesWithNsEnvSimple env s	= fromLA $ getXP (toNsEnv env) s---- ------------------------------------------getXP				:: NsEnv -> String -> LA XmlTree XmlTree-getXP env s			= either ( err-					   .-					   (("Syntax error in XPath expression " ++ show s ++ ": ") ++)-					   .-					   show . show-					 ) (fromMaybe (err ( "XPath expression " ++ show s ++-							     " too complicated for simple arrow evaluation"-							   )-						      ) . compXPath-					   )-				  -- . ( \ e -> T.trace (("getXP: xp = "++) . show $ e) e)-				  .-				  runParser parseXPath env ""-				  $ s---- ------------------------------------------type XPArrow b c		= Maybe (LA b c)--mk				:: LA b c -> XPArrow b c-mk				= Just--unwrap				:: XPArrow b b -> LA b b-unwrap				= fromJust . toThis--(>>>>)				:: XPArrow b b -> XPArrow b b -> XPArrow b b-Nothing   >>>> a2		= a2-a1        >>>> Nothing		= a1-(Just f1) >>>> (Just f2)	= return $ f1 >>> f2--(&&&&)				:: XPArrow b b -> XPArrow b b -> XPArrow b (b, b)-Nothing   &&&& a2		= this'' &&&& a2-a1        &&&& Nothing		= a1     &&&& this''-(Just f1) &&&& (Just f2)	= return $ f1 &&& f2--(<+>>)				:: XPArrow b b -> XPArrow b b -> XPArrow b b-Nothing   <+>> _a2		= Nothing-_a1       <+>> Nothing		= Nothing-(Just f1) <+>> (Just f2)	= return $ f1 <+> f2--guards'				:: XPArrow b b -> XPArrow b b -> XPArrow b b-Nothing   `guards'` a2		= a2-a1        `guards'` Nothing	= a1 `guards'` this''-(Just f1) `guards'` (Just f2)	= return $ f1 `guards` f2--this'				:: XPArrow b b-this'				= Nothing--this''				:: XPArrow b b-this''				= mk this--toThis				:: XPArrow b b -> XPArrow b b-toThis Nothing			= this''-toThis a			= a--getChildren'			:: XPArrow XmlTree XmlTree -> XPArrow XmlTree XmlTree-getChildren' a			= mk getChildren >>>> a--getAttrl'			:: XPArrow XmlTree XmlTree -> XPArrow XmlTree XmlTree-getAttrl' a			= mk getAttrl >>>> a--multi'				:: XPArrow XmlTree XmlTree -> XPArrow XmlTree XmlTree-multi' a			= mk $ multi (unwrap a)--deep'				:: XPArrow XmlTree XmlTree -> XPArrow XmlTree XmlTree-deep' a				= mk $ deep (unwrap a)--xIndex				:: Int -> LA [b] b-xIndex i-    | i <= 0			= none-    | otherwise			= arrL (take 1 . drop (i-1))--xString				:: XPArrow XmlTree XmlTree -> LA XmlTree String-xString a			= unwrap a >>> xshow (deep isText)--xNumber'			:: XPArrow XmlTree XmlTree -> LA XmlTree XPNumber-xNumber' a			=  xString a >>> arr toNumber---- --------------------------------deadEndStreet			:: Monad m => m a-deadEndStreet			= fail "XPath expression too complicated for XmlArrows"--compXPath			:: MonadPlus m => Expr -> m (LA XmlTree XmlTree)-compXPath e			= do-				  r <- compXP e-				  return $ unwrap r--compXP				:: MonadPlus m => Expr -> m (XPArrow XmlTree XmlTree)-compXP (PathExpr Nothing (Just (LocPath Abs lp)))-				= compLP lp this'-compXP (FilterExpr (e1:el))	= do-				  r <- compXP e1-				  compFP el r-compXP _			= deadEndStreet--compFP				:: MonadPlus m => [Expr] -> XPArrow XmlTree XmlTree -> m (XPArrow XmlTree XmlTree)-compFP []      r		= return r-compFP (e1:es) r		= do-				  r1 <- compPred [e1] r-				  compFP es r1--compLP				:: MonadPlus m => [XStep] -> XPArrow XmlTree XmlTree -> m (XPArrow XmlTree XmlTree)-compLP []     r			= return r-compLP (x:xs) r			= do-				  a1 <- compXS x r-				  as <- compLP xs a1-				  return as--compXS				:: MonadPlus m => XStep -> XPArrow XmlTree XmlTree -> m (XPArrow XmlTree XmlTree)-compXS (Step Child nt ps) s	= do-				  an <- compNTE nt-				  compPred ps (s >>>> mk getChildren >>>> an)--compXS (Step DescendantOrSelf nt ps) s-				= do-				  an <- compNTE nt-				  compPred ps (s >>>> multi' an)--compXS (Step Descendant nt ps) s-				= do-				  an <- compNTE nt-				  compPred ps (s >>>> mk getChildren >>>> multi' an)--compXS (Step Self nt ps) s-				= do-				  an <- compNTE nt-				  compPred ps (s >>>> an)-compXS (Step Attribute nt ps) s-				= do-				  an <- compNTA nt-				  compPred ps (s >>>> getAttrl' an)--compXS _ _			= deadEndStreet--compNTE				:: (Monad m) => NodeTest -> m (XPArrow XmlTree XmlTree)-compNTE (NameTest qn)		= compNameT isElem qn-compNTE nt			= compNT nt--compNTA				:: (Monad m) => NodeTest -> m (XPArrow XmlTree XmlTree)-compNTA (NameTest qn)		= compNameT isAttr qn-compNTA nt			= compNT nt--compNameT			:: Monad m => LA XmlTree XmlTree -> QName -> m (XPArrow XmlTree XmlTree)-compNameT ist qn-    | null (namespaceUri qn)	= return $ mk-				  ( if qualifiedName qn == "*"-				    then ist-				    else ist >>> hasName (qualifiedName qn)-				  )-    | otherwise			= return $ mk-				  ( if localPart qn == "*"-				    then ist >>> hasNamespaceUri (namespaceUri qn)-				    else ist >>> hasQName qn--				  )--compNT				:: Monad m => NodeTest -> m (XPArrow XmlTree XmlTree)-compNT (TypeTest XPNode)       	= return this'-compNT (TypeTest XPCommentNode)	= return $ mk isCmt-compNT (TypeTest XPPINode)      = return $ mk isPi-compNT (TypeTest XPTextNode)    = return $ mk isText--compNT _			= deadEndStreet--compPred			:: MonadPlus m => [Expr] -> XPArrow XmlTree XmlTree -> m (XPArrow XmlTree XmlTree)-compPred []     r		= return r-compPred (e:es)	r		= do-				  r1 <- compPred1 e r-				  compPred es r1--compPred1			:: MonadPlus m => Expr -> XPArrow XmlTree XmlTree -> m (XPArrow XmlTree XmlTree)-compPred1 e r			= ( do-				    ix <- compIntExpr e-				    return . mk $ listA (unwrap r) >>> xIndex ix-				  )-				  `mplus`-				  ( do-				    a1 <- compRelPathExpr e-				    return $ r >>>> (a1 `guards'` this')-				  )-				  `mplus`-				  ( do-				    a1 <- compGenExpr e-				    return $ r >>>> (a1 `guards'` this')-				  )-				  `mplus`-				  ( do-				    b1 <- compBoolExpr e-				    return $ if b1 then r else mk none-				  )--compRelPathExpr			:: MonadPlus m => Expr -> m (XPArrow XmlTree XmlTree)-compRelPathExpr (PathExpr Nothing (Just (LocPath Rel lp)))-				= compLP lp this'-compRelPathExpr _		= deadEndStreet--compStringExpr			:: MonadPlus m => Expr -> m String-compStringExpr (LiteralExpr s)	= return s-compStringExpr _		= deadEndStreet--compNumberExpr			:: MonadPlus m => Expr -> m XPNumber-compNumberExpr (NumberExpr n)	= return n-compNumberExpr (FctExpr "number" [f1])-				= ( do-				    b <- compBoolExpr f1-				    return $ if b then (Float 1) else Pos0-				  )-				  `mplus`-				  ( do-				    s <- compStringExpr f1-				    return $ toNumber s-				  )-compNumberExpr _		= deadEndStreet--compIntExpr			:: MonadPlus m => Expr -> m Int-compIntExpr e			= ( do-				    (Float f) <- compNumberExpr e-				    return (round f)-				  )-				  `mplus`-				  deadEndStreet---compBoolExpr			:: MonadPlus m => Expr -> m Bool-compBoolExpr (FctExpr f [])-    | f `elem` ["true", "false"]-				= return $ f == "true"-compBoolExpr (FctExpr "not" [f1])-				= do-				  v1 <- compBoolExpr f1-				  return $ not v1-compBoolExpr (LiteralExpr s)	= return $ not (null s)-compBoolExpr (NumberExpr n)	= return $ nz n-				  where-				  nz (Float f) = f /= 0-				  nz NegInf    = True-				  nz PosInf    = True-				  nz _         = False-compBoolExpr _			= deadEndStreet--compGenExpr			:: MonadPlus m => Expr -> m (XPArrow XmlTree XmlTree)-compGenExpr (GenExpr op [e1,e2])-				= compString op e1 e2		-- on arg is a string expr-				  `mplus`-				  compNumber op e1 e2		-- one arg is a number expr-				  `mplus`-				  compBool   op e1 e2		-- and/or-				  `mplus`-				  compPath   op e1 e2		-- nodeset equality--compGenExpr (GenExpr op (e1:el))-    | op `elem` [And, Or]	= compGenExpr (GenExpr op [e1, GenExpr op el])--compGenExpr _			= deadEndStreet--compString			:: MonadPlus m => Op -> Expr -> Expr -> m (XPArrow XmlTree XmlTree)-compString op e1 e2-    | op `elem` [Eq, NEq]	= ( do-				    s <- compStringExpr  e2-				    a <- compRelPathExpr e1-				    return $ mkEq' a s-				  )-				  `mplus`-				  ( do-				    s <- compStringExpr  e1-				    a <- compRelPathExpr e2-				    return $ mkEq' a s-				  )-				  where-				  mkEq' a' s' = mk ( ( xString a'-							>>>-							isA ( if op == Eq-							      then (== s')-							      else (/= s')-							    )-						      )-						      `guards` this	-- just for type match-						    )-compString _ _ _		= deadEndStreet--compNumber			:: MonadPlus m => Op -> Expr -> Expr -> m (XPArrow XmlTree XmlTree)-compNumber op e1 e2-    | op `elem` [Eq, NEq, Less, Greater, LessEq, GreaterEq]-				= ( do-				    n <- compNumberExpr  e2-				    a <- compRelPathExpr e1-				    return $ mkEq' a n-				  )-				  `mplus`-				  ( do-				    n <- compNumberExpr  e1-				    a <- compRelPathExpr e2-				    return $ mkEq' a n-				  )-				  where-				  mkEq' a' n' = mk ( ( xNumber' a'-							>>>-							isA (flip ( case op of-								    Eq        -> (==)-								    NEq       -> (/=)-								    Less      -> (<)-								    Greater   -> (>)-								    LessEq    -> (<=)-								    GreaterEq -> (>=)-								    _         -> error "compNumber: wrong arg"-								  ) n'-							    )-						      )-						      `guards` this-						    )-compNumber _ _ _		= deadEndStreet--compBool			:: MonadPlus m => Op -> Expr -> Expr -> m (XPArrow XmlTree XmlTree)-compBool And e1 e2		= ( do-				    b <- compBoolExpr e1-				    if b-				       then compGenExpr e2-				       else return $ mk none-				  )-				  `mplus`-				  ( do-				    b <- compBoolExpr e2-				    if b-				       then compGenExpr e1-				       else return $ mk none-				  )-				  `mplus`-				  ( do-				    a1 <- compGenExpr e1-				    a2 <- compGenExpr e2-				    return $ a1 `guards'` a2-				  )-compBool Or e1 e2		= ( do-				    b <- compBoolExpr e1-				    if b-                                       then return this'-				       else compGenExpr e2-				  )-				  `mplus`-				  ( do-				    b <- compBoolExpr e2-				    if b-                                       then return this'-				       else compGenExpr e1-				  )-				  `mplus`-				  ( do-				    a1 <- compGenExpr e1-				    a2 <- compGenExpr e2-				    return $ a1 <+>> a2-				  )-compBool _ _ _			= deadEndStreet--compPath			:: MonadPlus m => Op -> Expr -> Expr -> m (XPArrow XmlTree XmlTree)-compPath op e1 e2-    | op `elem` [Eq, NEq]	= ( do-				    a1 <- compRelPathExpr e2-				    a2 <- compRelPathExpr e1-				    return $ mk . cmp op $ ( ( listA (xString a1) &&& listA (xString a2))-							      >>>-							      eqs-							    )-				  )-				  where-				  eqs		= arr2L equalNodeSet-				  cmp Eq  a	= a `guards` this-				  cmp NEq a	= ifA a none this-				  cmp _ _	= error "compPath: wrong agruments"--compPath _ _ _			= deadEndStreet---- ------------------------------------------toNumber		:: String -> XPNumber-toNumber s		= let ( XPVNumber v) = parseNumber s in v--equalNodeSet		:: Eq a => [a] -> [a] -> [a]-equalNodeSet s1 s2	= [ x | x <- s1, y <- s2, x == y]---- ----------------------------------------
src/Text/XML/HXT/Version.hs view
@@ -1,4 +1,4 @@ module Text.XML.HXT.Version where hxt_version :: String-hxt_version = "8.4.1"+hxt_version = "8.5.0"
− src/Text/XML/HXT/XPath.hs
@@ -1,17 +0,0 @@--- |
--- This helper module exports elements from the basic libraries:
--- XPathEval, XPathToString and XPathParser
---
--- Author : Torben Kuseler
-
-
-module Text.XML.HXT.XPath
-    ( module Text.XML.HXT.XPath.XPathEval
-    , module Text.XML.HXT.XPath.XPathToString
-    , module Text.XML.HXT.XPath.XPathParser
-    ) 
-where
-
-import Text.XML.HXT.XPath.XPathEval
-import Text.XML.HXT.XPath.XPathToString
-import Text.XML.HXT.XPath.XPathParser
− src/Text/XML/HXT/XPath/NavTree.hs
@@ -1,79 +0,0 @@--- |--- Navigable tree structure which allow a program to traverse--- for XPath expressions--- copied and modified from HXML (<http://www.flightlab.com/~joe/hxml/>)-----module Text.XML.HXT.XPath.NavTree-    ( module Text.XML.HXT.XPath.NavTree-    , module Data.NavTree-    )-where--import Data.Maybe--import Data.NavTree--import Text.XML.HXT.DOM.Interface-    ( XNode-    , xmlnsNamespace-    , namespaceUri-    )--import Text.XML.HXT.DOM.XmlNode-    ( isRoot-    , isElem-    , getName-    , getAttrl-    )---- -------------------------------------------------------------------------------- functions for representing XPath axes. All axes except the namespace-axis are supported---parentAxis		:: NavTree a -> [NavTree a]-parentAxis		= maybeToList . upNT--ancestorAxis		:: NavTree a -> [NavTree a]-ancestorAxis 		= \(NT _ u _ _) -> u		-- or: maybePlus upNT--ancestorOrSelfAxis	:: NavTree a -> [NavTree a]-ancestorOrSelfAxis	= \t@(NT _ u _ _) -> t:u	-- or: maybeStar upNT--childAxis		:: NavTree a -> [NavTree a]-childAxis		= maybe [] (maybeStar rightNT) . downNT--descendantAxis		:: NavTree a -> [NavTree a]-descendantAxis		= tail . preorderNT -- concatMap preorderNT . childAxis--descendantOrSelfAxis		:: NavTree a -> [NavTree a]-descendantOrSelfAxis	= preorderNT--followingSiblingAxis	:: NavTree a -> [NavTree a]-followingSiblingAxis	= maybePlus rightNT--precedingSiblingAxis	:: NavTree a -> [NavTree a]-precedingSiblingAxis	= maybePlus leftNT--selfAxis		:: NavTree a -> [NavTree a]-selfAxis		= wrap  where wrap x = [x]--followingAxis		:: NavTree a -> [NavTree a]-followingAxis		= preorderNT     `o'` followingSiblingAxis `o'` ancestorOrSelfAxis--precedingAxis		:: NavTree a -> [NavTree a]-precedingAxis		= revPreorderNT  `o'` precedingSiblingAxis `o'` ancestorOrSelfAxis---attributeAxis :: NavTree XNode -> [NavTree XNode]-attributeAxis t@(NT xt a _ _)-    | isElem xt-      &&-      not (isRoot xt)-	= foldr (\ attr -> ((NT attr (t:a) [] []):)) [] al-    | otherwise-	= []-    where-    al = filter ((/= xmlnsNamespace) . maybe "" namespaceUri . getName) . fromMaybe [] . getAttrl $ xt---- ------------------------------------------------------------
− src/Text/XML/HXT/XPath/XPathArithmetic.hs
@@ -1,166 +0,0 @@--- |--- The module contains arithmetic calculations according the IEEE 754 standard--- for plus, minus, unary minus, multiplication, modulo and division.------module Text.XML.HXT.XPath.XPathArithmetic-    ( xPathMulti-    , xPathMod-    , xPathDiv-    , xPathAdd-    , xPathUnary-    )-where--import Text.XML.HXT.XPath.XPathDataTypes----- |--- Unary minus: the value 'NaN' is not calculatable and returned unchanged,--- all other values can be denied.-----xPathUnary :: XPathFilter-xPathUnary (XPVNumber (Float f)) =  XPVNumber (Float (-f))-xPathUnary (XPVError e)          = XPVError e-xPathUnary (XPVNumber NaN)       = XPVNumber NaN-xPathUnary (XPVNumber Pos0)      = XPVNumber Neg0-xPathUnary (XPVNumber Neg0)      = XPVNumber Pos0-xPathUnary (XPVNumber PosInf)    = XPVNumber NegInf-xPathUnary (XPVNumber NegInf)    = XPVNumber PosInf-xPathUnary _                     = XPVError "Call to unaryEval without a number"----- |--- Multiplication-----xPathMulti :: Op -> XPathValue -> XPathFilter-xPathMulti _ (XPVNumber (Float a)) (XPVNumber (Float b))-    = XPVNumber (Float (a * b))-xPathMulti _ (XPVNumber NegInf) (XPVNumber (Float a))-    | a < 0     = XPVNumber PosInf-    | otherwise = XPVNumber NegInf-xPathMulti _ (XPVNumber PosInf) (XPVNumber (Float a))-    | a < 0     = XPVNumber NegInf-    | otherwise = XPVNumber PosInf-xPathMulti _ (XPVNumber (Float a)) (XPVNumber NegInf)-    | a < 0     = XPVNumber PosInf-    | otherwise = XPVNumber NegInf-xPathMulti _ (XPVNumber (Float a)) (XPVNumber PosInf)-    | a < 0     = XPVNumber NegInf-    | otherwise = XPVNumber PosInf-xPathMulti _ (XPVNumber Pos0) (XPVNumber (Float a))-    | a < 0     = XPVNumber Neg0-    | otherwise = XPVNumber Pos0-xPathMulti _ (XPVNumber Neg0) (XPVNumber (Float a))-    | a < 0     = XPVNumber Pos0-    | otherwise = XPVNumber Neg0-xPathMulti _ (XPVNumber (Float a)) (XPVNumber Pos0)-    | a < 0     = XPVNumber Neg0-    | otherwise = XPVNumber Pos0-xPathMulti _ (XPVNumber (Float a)) (XPVNumber Neg0)-    | a < 0     = XPVNumber Pos0-    | otherwise = XPVNumber Neg0-xPathMulti a b c = xPathSpez a b c----- |--- Modulo-----xPathMod :: Op -> XPathValue -> XPathFilter-xPathMod _ (XPVNumber (Float a)) (XPVNumber (Float b))-    | floatMod a b == 0 = XPVNumber Pos0-    | otherwise = XPVNumber (Float (floatMod a b))-      where-      floatMod x y-        | x/y >= 0 = x - y * fromInteger(floor (x / y))-        | otherwise =x - y * fromInteger(ceiling (x / y))--xPathMod _ (XPVNumber (Float a)) (XPVNumber NegInf)-    = XPVNumber (Float a)-xPathMod _ (XPVNumber (Float a)) (XPVNumber PosInf)-    = XPVNumber (Float a)-xPathMod _ (XPVNumber Neg0) (XPVNumber Pos0)-    = XPVNumber Neg0-xPathMod a b c = xPathSpez a b c----- |--- Division: the divison-operator is not according the IEEE 754 standard,--- it calculates the same as the % operator in Java and ECMAScript-----xPathDiv :: Op -> XPathValue -> XPathFilter-xPathDiv _ (XPVNumber (Float a)) (XPVNumber (Float b))-    = XPVNumber (Float (a / b))-xPathDiv _ (XPVNumber NegInf) (XPVNumber (Float a))-    | a < 0     = XPVNumber PosInf-    | otherwise = XPVNumber NegInf-xPathDiv _ (XPVNumber PosInf) (XPVNumber (Float a))-    | a < 0     = XPVNumber NegInf-    | otherwise = XPVNumber PosInf-xPathDiv _ (XPVNumber (Float a)) (XPVNumber NegInf)-    | a < 0     = XPVNumber Pos0-    | otherwise = XPVNumber Neg0-xPathDiv _ (XPVNumber (Float a)) (XPVNumber PosInf)-    | a < 0     = XPVNumber Neg0-    | otherwise = XPVNumber Pos0-xPathDiv _ (XPVNumber Neg0) (XPVNumber (Float a))-    | a < 0     = XPVNumber Pos0-    | otherwise = XPVNumber Neg0-xPathDiv _ (XPVNumber (Float a)) (XPVNumber Neg0)-    | a < 0     = XPVNumber PosInf-    | otherwise = XPVNumber NegInf-xPathDiv _ (XPVNumber (Float a)) (XPVNumber Pos0)-    | a < 0     = XPVNumber NegInf-    | otherwise = XPVNumber PosInf-xPathDiv a b c  = xPathSpez a b c----- |--- Plus and minus------    1.parameter op :  plus or minus operation-----xPathAdd :: Op -> XPathValue -> XPathFilter-xPathAdd Plus (XPVNumber (Float a)) (XPVNumber (Float b))-    = if a + b == 0-        then XPVNumber Pos0-        else XPVNumber (Float (a+b))-xPathAdd Minus (XPVNumber (Float a)) (XPVNumber (Float b))-    = if a - b == 0-        then XPVNumber Pos0-        else XPVNumber (Float (a-b))-xPathAdd _ (XPVNumber PosInf) (XPVNumber NegInf)  = XPVNumber NaN-xPathAdd _ (XPVNumber NegInf) (XPVNumber PosInf)  = XPVNumber NaN-xPathAdd _ (XPVNumber PosInf) _                   = XPVNumber PosInf-xPathAdd _ (XPVNumber NegInf) _                   = XPVNumber NegInf-xPathAdd _ _ (XPVNumber PosInf)                   = XPVNumber PosInf-xPathAdd _ _ (XPVNumber NegInf)                   = XPVNumber NegInf-xPathAdd _ (XPVNumber (Float a)) (XPVNumber Pos0) = XPVNumber (Float a)-xPathAdd op (XPVNumber Pos0) (XPVNumber (Float a))-    | op == Minus = XPVNumber (Float (-a))-    | otherwise   = XPVNumber (Float a)-xPathAdd op (XPVNumber Neg0) (XPVNumber (Float a))-    | op == Minus = XPVNumber (Float (-a))-    | otherwise   = XPVNumber (Float a)-xPathAdd _ (XPVNumber (Float a)) (XPVNumber Neg0) = XPVNumber (Float a)-xPathAdd _ (XPVNumber Neg0) (XPVNumber Pos0)      = XPVNumber Neg0-xPathAdd _ (XPVNumber Pos0) (XPVNumber Neg0)      = XPVNumber Neg0-xPathAdd _ (XPVNumber Neg0) (XPVNumber Neg0)      = XPVNumber Neg0-xPathAdd _ (XPVNumber Pos0) (XPVNumber Pos0)      = XPVNumber Pos0-xPathAdd a b c = xPathSpez a b c----- |--- Identically results of the operators are combined to get--- as few as possible combinations of the special IEEE values----xPathSpez :: Op -> XPathValue -> XPathFilter-xPathSpez _ (XPVError e) _ = XPVError e-xPathSpez _ _ (XPVError e) = XPVError e-xPathSpez _ _ _            = XPVNumber NaN
− src/Text/XML/HXT/XPath/XPathDataTypes.hs
@@ -1,285 +0,0 @@--- --------------------------------------------------------------{- |-   Module     : Text.XML.HXT.XPath.XPathDataTypes-   Copyright  : Copyright (C) 2006 Uwe Schmidt-   License    : MIT--   Maintainer : Uwe Schmidt (uwe@fh-wedel.de)-   Stability  : experimental-   Portability: portable--   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/>)---}---- --------------------------------------------------------------module Text.XML.HXT.XPath.XPathDataTypes-    ( module Text.XML.HXT.XPath.XPathDataTypes-    , module Text.XML.HXT.XPath.NavTree-    )-where--import Text.XML.HXT.XPath.NavTree-import Text.XML.HXT.DOM.Interface---- ----------------------------------------------------------------------------------- Expr---- | Represents expression--- --data Expr     = 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-              deriving (Show, Eq)----- ----------------------------------------------------------------------------------- Op---- | Represents XPath operators--data Op       = Or | And | Eq | NEq | Less | Greater | LessEq-              | GreaterEq |Plus | Minus | Div | Mod | Mult| Unary | Union-              deriving (Show, Eq)----- ----------------------------------------------------------------------------------- |--- 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.--data XPNumber = Float Float  -- ^ floating-point number-              | NaN          -- ^ not-a-number-              | NegInf       -- ^ negative infinity-              | Neg0         -- ^ negative zero-              | Pos0         -- ^ positive zero-              | PosInf       -- ^ positive infinity---instance Show XPNumber-    where-    show NaN           = "NaN"-    show NegInf        = "-Infinity"-    show Neg0          = "-0"-    show Pos0          = "0"-    show (Float f)     = show f-    show PosInf        = "Infinity"------ Negative zero is equal to positive zero,--- equality test with NaN-value is always false-instance Eq XPNumber-    where-    NegInf  == NegInf  = True-    Pos0    == Neg0    = True-    Neg0    == Pos0    = True-    Pos0    == Pos0    = True-    Neg0    == Neg0    = True-    Float f == Float g = f == g-    PosInf  == PosInf  = True-    _       == _       = False---instance Ord XPNumber-    where-    a       <= b       = (a < b) || (a == b)-    a       >= b       = (a > b) || (a == b)-    a       >  b       =  b < a--    NaN     < _        = False-    _       < NaN      = False--    _       < NegInf   = False-    NegInf  < _	       = True--    Neg0    < Neg0     = False-    Pos0    < Pos0     = False-    Pos0    < Neg0     = False-    Neg0    < Pos0     = False--    Neg0    < Float f  = 0 < f-    Pos0    < Float f  = 0 < f-    Float f < Neg0     = f < 0-    Float f < Pos0     = f < 0--    Float f < Float g  = f < g--    PosInf  < _        = False-    _       < PosInf   = True----- -------------------------------------------------------------------------------- | Represents location path------ A location path consists of a sequence of one or more location steps.--data LocationPath = LocPath Path [XStep]-                  deriving (Show, Eq)----- -----------------------------------------------------------------------------                  --- |--- A location path is either a relative or an absolute path.--data Path         = Rel | Abs-                  deriving (Show, Eq)-					---- | Represents location step--- --- A location step consists of an axis, a node-test and zero or more predicates.--data XStep        = Step AxisSpec NodeTest [Expr]-                  deriving (Show, Eq)--			--- ----------------------------------------------------------------------------------- AxisSpec---- | Represents XPath axis--data AxisSpec     = Ancestor | AncestorOrSelf | Attribute | Child | Descendant  -                  | DescendantOrSelf | Following | FollowingSibling-                  | Namespace | Parent | Preceding | PrecedingSibling | Self-                  deriving (Show, Eq)----- ----------------------------------------------------------------------------------- NodeTest---- | Represents XPath node-tests----data NodeTest     = NameTest Name     -- ^ name-test-data NodeTest     = NameTest QName     -- ^ name-test-                  | PI String           -- ^ processing-instruction-test with a literal argument-                  | TypeTest XPathNode  -- ^ all nodetype-tests-                  deriving (Show, Eq)-------- ----------------------------------------------------------------------------------- XPathNode---- | Represents nodetype-tests--data XPathNode    = XPNode            -- ^ all 7 nodetypes-                                      --  (root, element, attribute, namespace, pi, comment, text)-                  | XPCommentNode     -- ^ comment-nodes-                  | XPPINode          -- ^ processing-instruction-nodes-                  | XPTextNode        -- ^ text-nodes: cdata, character data-                  deriving (Show, Eq)----- ----------------------------------------------------------------------------------- useful type definitions--type Name = (NamePrefix, LocalName)-type NamePrefix = String-type LocalName = String---- | Variable name-type VarName      = Name---- | a string-type Literal      = String					---- | Function name-type FctName      = String---- | Function arguments-type FctArguments = [Expr]---- | Evaluation context-type Context      = (ConPos ,ConLen, ConNode)---- | Context position-type ConPos       = Int---- | Context length-type ConLen       = Int---- | Context node-type ConNode      = NavXmlTree------ ----------------------------------------------------------------------------------- XPathValue---- | Represents XPath results--data XPathValue   = 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-                  deriving (Show, Eq, Ord)----- ----------------------------------------------------------------------------------- Basic types for navigable tree and filters---- | Node of navigable tree representation--type NavXmlTree   = NavTree XNode---- | List of nodes of navigable tree representation--type NavXmlTrees  = [NavXmlTree]---- | Type synonym for a list of navigable tree representation--type NodeSet      = NavXmlTrees---- | A functions that takes a XPath result and returns a XPath result--type XPathFilter  = XPathValue -> XPathValue------ ----------------------------------------------------------------------------------- Env---- | XPath environment------ All variables are stored in the environment,--- each variable name is bound to a value.--type VarTab       = [(VarName, XPathValue)]-type KeyTab       = [(QName, String, NavXmlTree)]--type Env          = (VarTab, KeyTab)--varEnv :: Env-varEnv = ( [ (("", "name"), XPVNumber NaN) ]-	 , []-         )---- -----------------------------------------------------------------------------
− src/Text/XML/HXT/XPath/XPathEval.hs
@@ -1,662 +0,0 @@--- --------------------------------------------------------------{- |-   Module     : Text.XML.HXT.XPath.XPathEval-   Copyright  : Copyright (C) 2006 Uwe Schmidt-   License    : MIT--   Maintainer : Uwe Schmidt (uwe@fh-wedel.de)-   Stability  : experimental-   Portability: portable-   Version    : $Id: XPathEval.hs,v 1.8 2006/10/12 11:51:29 hxml Exp $--   The core functions for evaluating the different types of XPath expressions.-   Each 'Expr'-constructor is mapped to an evaluation function.---}---- --------------------------------------------------------------module Text.XML.HXT.XPath.XPathEval-    ( getXPath-    , getXPathWithNsEnv-    , getXPathSubTrees-    , getXPathSubTreesWithNsEnv-    , getXPathNodeSet-    , getXPathNodeSetWithNsEnv-    , evalExpr-    )-where--import Text.XML.HXT.XPath.XPathFct-import Text.XML.HXT.XPath.XPathDataTypes-import Text.XML.HXT.XPath.XPathArithmetic-    ( xPathAdd-    , xPathDiv-    , xPathMod-    , xPathMulti-    , xPathUnary-    )-import Text.XML.HXT.XPath.XPathParser-    ( parseXPath )--import Text.XML.HXT.XPath.XPathToString-    ( xPValue2XmlTrees )--import Text.XML.HXT.XPath.XPathToNodeSet-    ( xPValue2NodeSet-    , emptyNodeSet-    )--import Text.ParserCombinators.Parsec-    ( runParser )--import Data.Maybe-    ( fromJust )---- -------------------------------------------- the DOM functions--import           Text.XML.HXT.DOM.Interface-import qualified Text.XML.HXT.DOM.XmlNode as XN---- -------------------------------------------- the list arrow functions--import Control.Arrow			( (>>>), (>>^) )-import Control.Arrow.ArrowList		( arrL, isA )-import Control.Arrow.ArrowIf    	( filterA )-import Control.Arrow.ListArrow		( runLA )-import qualified-       Control.Arrow.ArrowTree		as AT-import Text.XML.HXT.Arrow.XmlArrow	( ArrowDTD, isDTD, getDTDAttrl )-import Text.XML.HXT.Arrow.Edit		( canonicalizeForXPath )---- --------------------------------------------------------------------------------- |--- Select parts of a document by an XPath expression.------ The main filter for selecting parts of a document via XPath.--- The string argument must be a XPath expression with an absolute location path,--- the argument tree must be a complete document tree.--- Result is a possibly empty list of XmlTrees forming the set of selected XPath values.--- XPath values other than XmlTrees (numbers, attributes, tagnames, ...)--- are convertet to text nodes.--getXPath		:: String -> XmlTree -> XmlTrees-getXPath		= getXPathWithNsEnv []---- |--- Select parts of a document by a namespace aware XPath expression.------ Works like 'getXPath' but the prefix:localpart names in the XPath expression--- are interpreted with respect to the given namespace environment--getXPathWithNsEnv	:: Attributes -> String -> XmlTree -> XmlTrees-getXPathWithNsEnv env s	= runLA ( canonicalizeForXPath-				  >>>-				  arrL (getXPathValues xPValue2XmlTrees xPathErr (toNsEnv env) s)-				)---- |--- Select parts of an XML tree by a XPath expression.------ The main filter for selecting parts of an arbitrary XML tree via XPath.--- The string argument must be a XPath expression with an absolute location path,--- There are no restrictions on the arument tree.------ No canonicalization is performed before evaluating the query------ Result is a possibly empty list of XmlTrees forming the set of selected XPath values.--- XPath values other than XmlTrees (numbers, attributes, tagnames, ...)--- are convertet to text nodes.--getXPathSubTrees	:: String -> XmlTree -> XmlTrees-getXPathSubTrees	= getXPathSubTreesWithNsEnv []---- | Same as 'getXPathSubTrees' but with namespace aware XPath expression--getXPathSubTreesWithNsEnv	:: Attributes -> String -> XmlTree -> XmlTrees-getXPathSubTreesWithNsEnv nsEnv xpStr-    = getXPathValues xPValue2XmlTrees xPathErr (toNsEnv nsEnv) xpStr---- | compute the node set of an XPath query--getXPathNodeSet		:: String -> XmlTree -> XmlNodeSet-getXPathNodeSet		= getXPathNodeSetWithNsEnv []---- | compute the node set of a namespace aware XPath query--getXPathNodeSetWithNsEnv	:: Attributes -> String -> XmlTree -> XmlNodeSet-getXPathNodeSetWithNsEnv nsEnv xpStr-    = getXPathValues xPValue2NodeSet (const (const emptyNodeSet)) (toNsEnv nsEnv) xpStr---- | parse xpath, evaluate xpath expr and prepare results--getXPathValues	:: (XPathValue -> a) -> (String -> String -> a) -> NsEnv -> String -> XmlTree -> a-getXPathValues cvRes cvErr nsEnv xpStr t-    = case (runParser parseXPath nsEnv "" xpStr) of-      Left parseError-	  -> cvErr xpStr (show parseError)-      Right xpExpr-	  -> evalXP xpExpr-    where-    evalXP xpe-	= cvRes xpRes-	where-	t'      = addRoot t				-- we need a root node for starting xpath eval-	idAttr	= ( ("", "idAttr")			-- id attributes from DTD (if there)-		  , idAttributesToXPathValue . getIdAttributes $ t'-		  )-	navTD	= ntree t'-	xpRes	= evalExpr (idAttr:(getVarTab varEnv),[]) (1, 1, navTD) xpe (XPVNode [navTD])--addRoot	:: XmlTree -> XmlTree-addRoot t-    | XN.isRoot t-	= t-    | otherwise-	= XN.mkRoot [] [t]--xPathErr	:: String -> String -> [XmlTree]-xPathErr xpStr parseError-    = [XN.mkError c_err ("Syntax error in XPath expression " ++ show xpStr ++ ": " ++ show parseError)]---- |--- The main evaluation entry point. --- Each XPath-'Expr' is mapped to an evaluation function. The 'Env'-parameter contains the set of global variables--- for the evaluator, the 'Context'-parameter the root of the tree in which the expression is evaluated.--- --evalExpr :: Env -> Context -> Expr -> XPathFilter-evalExpr env cont (GenExpr Or ex)-    = boolEval env cont Or ex-evalExpr env cont (GenExpr And ex)-    = boolEval env cont And ex-    -evalExpr env cont (GenExpr Eq ex)-    = relEqEval env cont Eq . evalExprL env cont ex-evalExpr env cont (GenExpr NEq ex)-    = relEqEval env cont NEq . evalExprL env cont ex-evalExpr env cont (GenExpr Less ex)-    = relEqEval env cont Less . evalExprL env cont ex-evalExpr env cont (GenExpr LessEq ex)-    = relEqEval env cont LessEq . evalExprL env cont ex-evalExpr env cont (GenExpr Greater ex)-    = relEqEval env cont Greater . evalExprL env cont ex-evalExpr env cont (GenExpr GreaterEq ex)-    = relEqEval env cont GreaterEq . evalExprL env cont ex--evalExpr env cont (GenExpr Plus ex)-    = numEval xPathAdd Plus . toXValue xnumber cont env . evalExprL env cont ex-evalExpr env cont (GenExpr Minus ex)-    = numEval xPathAdd Minus . toXValue xnumber cont env . evalExprL env cont ex-evalExpr env cont (GenExpr Div ex)-    = numEval xPathDiv Div . toXValue xnumber cont env . evalExprL env cont ex-evalExpr env cont (GenExpr Mod ex)-    = numEval xPathMod Mod . toXValue xnumber cont env . evalExprL env cont ex-evalExpr env cont (GenExpr Mult ex)-    = numEval xPathMulti Mult . toXValue xnumber cont env . evalExprL env cont ex--evalExpr env cont (GenExpr Unary ex)-    = xPathUnary . xnumber cont env . evalExprL env cont ex--evalExpr env cont (GenExpr Union ex)-    = unionEval . evalExprL env cont ex--evalExpr env cont (FctExpr name args)-    = fctEval env cont name args--evalExpr env _ (PathExpr Nothing (Just lp))-    = locPathEval env lp-evalExpr env cont (PathExpr (Just fe) (Just lp))-    = locPathEval env lp . evalExpr env cont fe--evalExpr env cont (FilterExpr ex)-    = filterEval env cont ex-evalExpr env _ ex-    = evalSpezExpr env ex----evalExprL :: Env -> Context -> [Expr] -> XPathValue -> [XPathValue]-evalExprL env cont ex ns-    = map (\e -> evalExpr env cont e ns) ex--evalSpezExpr :: Env -> Expr -> XPathFilter-evalSpezExpr _ (NumberExpr (Float 0)) _-    = XPVNumber Pos0-evalSpezExpr _ (NumberExpr (Float f)) _-    = XPVNumber (Float f)-evalSpezExpr _ (LiteralExpr s) _-    = XPVString s-evalSpezExpr env (VarExpr name) v-    = getVariable env name v-evalSpezExpr _ _ _-    = XPVError "Call to evalExpr with a wrong argument"----- --------------------------------------------------------------------------------- |--- filter for evaluating a filter-expression-filterEval :: Env -> Context -> [Expr] -> XPathFilter-filterEval env cont (prim:predicates) ns-    = case evalExpr env cont prim ns of-        new_ns@(XPVNode _) -> evalPredL env predicates new_ns-        _                  -> XPVError "Return of a filterexpression is not a nodeset"-filterEval _ _ _ _-    = XPVError "Call to filterEval without an expression"------ |--- returns the union of its arguments, the arguments have to be node-sets.-unionEval :: [XPathValue] -> XPathValue-unionEval-    = createDocumentOrder . remDups . unionEval'-      where-      unionEval' (e@(XPVError _):_)           = e-      unionEval' (_:e@(XPVError _):_)         = e-      unionEval' [n@(XPVNode _)]              = n-      unionEval' ((XPVNode n):(XPVNode m):xs) = unionEval ( (XPVNode (n ++ m)):xs)-      unionEval' _                            = XPVError "The value of a union ( | ) is not a nodeset"------ |--- Equality or relational test for node-sets, numbers, boolean values or strings,--- each computation of two operands is done by relEqEv'-relEqEval :: Env -> Context -> Op -> [XPathValue] -> XPathValue-relEqEval env cont op-    = foldl1 (relEqEv' env cont op)--    --relEqEv' :: Env -> Context -> Op -> XPathValue -> XPathFilter-relEqEv' _ _ _ e@(XPVError _) _ = e-relEqEv' _ _ _ _ e@(XPVError _) = e---- two node-sets-relEqEv' env cont op a@(XPVNode _) b@(XPVNode _)-    = relEqTwoNodes env cont op a b---- one node-set-relEqEv' env cont op a b@(XPVNode _)-    = relEqOneNode env cont (fromJust $ getOpFct op) a b-relEqEv' env cont op a@(XPVNode _) b-    = relEqOneNode env cont (flip $ fromJust $ getOpFct op) b a-----  test without a node-set and equality or not-equality operator-relEqEv' env cont Eq a b  = eqEv env cont (==) a b-relEqEv' env cont NEq a b = eqEv env cont (/=) a b---- test without a node-set and less, less-equal, greater or greater-equal operator-relEqEv' env cont op a b-    = XPVBool ((fromJust $ getOpFct op) (toXNumber a) (toXNumber b))-      where-      toXNumber x = xnumber cont env [x]------ |--- Equality or relational test for two node-sets.--- The comparison will be true if and only if there is a node in the first node-set--- and a node in the second node-set such that the result of performing the--- comparison on the string-values of the two nodes is true-relEqTwoNodes :: Env -> Context -> Op -> XPathValue -> XPathFilter-relEqTwoNodes _ _ op (XPVNode ns) (XPVNode ms)-    = XPVBool (foldr  (\n -> (any (fct op n) (getStrValues ms) ||)) False ns)-      where-      fct op' n'   = (fromJust $ getOpFct op') (stringValue n')-      getStrValues = map stringValue-relEqTwoNodes _ _ _ _ _-    = XPVError "Call to relEqTwoNodes without a nodeset"----- |--- Comparison between a node-set and different type.--- The node-set is converted in a boolean value if the second argument is of type boolean.--- If the argument is of type number, the node-set is converted in a number, otherwise it is converted--- in a string value.-relEqOneNode :: Env -> Context -> (XPathValue -> XPathValue -> Bool) -> XPathValue -> XPathFilter-relEqOneNode env cont fct arg (XPVNode ns)-    = XPVBool (any  (fct arg) (getStrValues arg ns))-      where-      getStrValues arg' = map ((fromJust $ getConvFct arg') cont env . wrap) . map stringValue-      wrap x = [x]-relEqOneNode _ _ _ _ _-    = XPVError "Call to relEqOneNode without a nodeset"------ |--- No node-set is involved and the operator is equality or not-equality.--- The arguments are converted in a common type. If one argument is a boolean value--- then it is the boolean type. If a number is involved, the arguments have to converted in numbers,--- else the string type is the common type.-eqEv :: Env -> Context -> (XPathValue -> XPathValue -> Bool) -> XPathValue -> XPathFilter-eqEv env cont fct f@(XPVBool _) g-    = XPVBool (f `fct` xboolean cont env [g])-eqEv env cont fct f g@(XPVBool _)-    = XPVBool (xboolean cont env [f] `fct` g)--eqEv env cont fct f@(XPVNumber _) g-    = XPVBool (f `fct` xnumber cont env [g])-eqEv env cont fct f g@(XPVNumber _)-    = XPVBool (xnumber cont env [f] `fct` g)--eqEv env cont fct f g-    = XPVBool (xstring cont env [f] `fct` xstring cont env [g])---getOpFct :: Op -> Maybe (XPathValue -> XPathValue -> Bool)-getOpFct Eq        = Just (==)-getOpFct NEq       = Just (/=)-getOpFct Less      = Just (<)-getOpFct LessEq    = Just (<=)-getOpFct Greater   = Just (>)-getOpFct GreaterEq = Just (>=)-getOpFct _         = Nothing------ |--- Filter for accessing the root element of a document tree-getRoot :: XPathFilter-getRoot (XPVNode (n:_))-    = XPVNode [getRoot' n]-      where-      getRoot' tree-        = case upNT tree of-            Nothing -> tree-            Just t -> getRoot' t-getRoot _-    = XPVError "Call to getRoot without a nodeset"------ |--- Filter for accessing all nodes of a XPath-axis------    * 1.parameter as :  axis specifier----getAxisNodes :: AxisSpec ->  XPathFilter-getAxisNodes as (XPVNode ns)-    = XPVNode (concat $ map (fromJust $ lookup as axisFctL) ns)-getAxisNodes _ _-    = XPVError "Call to getAxis without a nodeset"------ |--- Axis-Function-Table.--- Each XPath axis-specifier is mapped to the corresponding axis-function-axisFctL :: [(AxisSpec, (NavXmlTree -> NavXmlTrees))]-axisFctL = [ (Ancestor, ancestorAxis)-           , (AncestorOrSelf, ancestorOrSelfAxis)-           , (Attribute, attributeAxis)-           , (Child, childAxis)-           , (Descendant, descendantAxis)-           , (DescendantOrSelf, descendantOrSelfAxis)-           , (Following, followingAxis)-           , (FollowingSibling, followingSiblingAxis)-           , (Parent, parentAxis)-           , (Preceding, precedingAxis)-           , (PrecedingSibling, precedingSiblingAxis)-           , (Self, selfAxis)-           ]----- |--- evaluates a location path,--- evaluation of an absolute path starts at the document root, --- the relative path at the context node-locPathEval :: Env -> LocationPath -> XPathFilter-locPathEval env (LocPath Rel steps)-    = evalSteps env steps-locPathEval env (LocPath Abs steps)-    = evalSteps env steps . getRoot-----evalSteps :: Env -> [XStep] -> XPathFilter-evalSteps env steps ns-    = foldl (evalStep env) ns steps----- |--- evaluate a single XPath step--- namespace-axis is not supported-evalStep :: Env -> XPathValue -> XStep -> XPathValue-evalStep _   _  (Step Namespace _ _)  = XPVError "namespace-axis not supported"-evalStep _   ns (Step Attribute nt _) = evalAttr nt (getAxisNodes Attribute ns)-evalStep env ns (Step axisSpec nt pr) = evalStep' env pr nt (getAxisNodes axisSpec ns)----evalAttr :: NodeTest -> XPathFilter-evalAttr nt (XPVNode ns)-    = XPVNode (foldr (\n -> (evalAttrNodeTest nt n ++)) [] ns)-evalAttr _ _-    = XPVError "Call to evalAttr without a nodeset"---evalAttrNodeTest :: NodeTest -> NavXmlTree -> NavXmlTrees-evalAttrNodeTest (NameTest qn) ns@(NT (NTree (XAttr qn1) _) _ _ _)-    = if ( ( uri == uri1               && lp == lp1)-	   || -           ((uri == "" || uri == uri1) && lp == "*") -         )-      then [ns]-      else []-      where-      uri  = namespaceUri qn-      uri1 = namespaceUri qn1-      lp   = localPart    qn-      lp1  = localPart    qn1--evalAttrNodeTest (TypeTest XPNode) ns@(NT (NTree (XAttr _) _) _ _ _)-    = [ns]--evalAttrNodeTest _ _-    = []--evalStep' :: Env -> [Expr] -> NodeTest -> XPathFilter-evalStep' env pr nt-    = evalPredL env pr . nodeTest nt---evalPredL :: Env -> [Expr] -> XPathFilter-evalPredL env pr n@(XPVNode ns)-    = remDups $ foldl (evalPred env 1 (length ns)) n pr-evalPredL _ _ _-    = XPVError "Call to evalPredL without a nodeset"---evalPred :: Env -> Int -> Int -> XPathValue -> Expr -> XPathValue-evalPred _ _ _ ns@(XPVNode []) _ = ns-evalPred env pos len (XPVNode (x:xs)) ex-    = case testPredicate env (pos, len, x) ex (XPVNode [x]) of-        e@(XPVError _) -> e-        XPVBool True   -> XPVNode (x : n)-        XPVBool False  -> nextNode-        _              -> XPVError "Value of testPredicate is not a boolean"-      where nextNode@(XPVNode n) = evalPred env (pos+1) len (XPVNode xs) ex-evalPred _ _ _ _ _-    = XPVError "Call to evalPred without a nodeset"----testPredicate :: Env -> Context -> Expr -> XPathFilter-testPredicate env context@(pos, _, _) ex ns-    = case evalExpr env context ex ns of-        XPVNumber (Float f) -> XPVBool (f == fromIntegral pos)-        XPVNumber _         -> XPVBool False-        _                   -> xboolean context env [evalExpr env context ex ns]----- |--- filter for selecting a special type of nodes from the current fragment tree------ the filter works with namespace activated and without namespaces.--- If namespaces occur in XPath names, the uris are used for matching,--- else the name prefix------    Bugfix : "*" (or any other name-test) must not match the root node--nodeTest :: NodeTest -> XPathFilter---- nodeTest (NameTest (QN "" "*" ""))      = filterNodes (\n -> isXTagNode n && not (isRootNode n))--- nodeTest (NameTest (QN _ "*" uri))      = filterNodes (filterd uri)--nodeTest (NameTest q)-    | isWildcardTest-	= filterNodes (wildcardTest q)-    | otherwise-        = filterNodes (nameTest q)		-- old: (isOfTagNode1 q)-      where-      isWildcardTest = localPart q == "*"--nodeTest (PI n)                         = filterNodes isPiNode-					  where-					  isPiNode = maybe False ((== n) . qualifiedName) . XN.getPiName--nodeTest (TypeTest t)                   = typeTest t--nameTest	:: QName -> XNode -> Bool-nameTest xpName (XTag elemName _)-    | namespaceAware-	= localPart xpName == localPart elemName-	  &&-	  namespaceUri xpName == namespaceUri elemName-    | otherwise-	= qualifiedName xpName == qualifiedName elemName-    where-    namespaceAware = not . null . namespaceUri $ xpName--nameTest _ _ = False--wildcardTest	:: QName -> XNode -> Bool-wildcardTest xpName (XTag elemName _)-    | namespaceAware-	= namespaceUri xpName == namespaceUri elemName-    | prefixMatch-	= namePrefix xpName == namePrefix elemName-    | otherwise-	= localPart elemName /= t_root			-- all names except the root name "/"-    where-    namespaceAware = not . null . namespaceUri $ xpName-    prefixMatch    = not . null . namePrefix   $ xpName--wildcardTest _ _ = False---- |--- tests whether a node is of a special type----typeTest :: XPathNode -> XPathFilter-typeTest XPNode         = id-typeTest XPCommentNode  = filterNodes XN.isCmt-typeTest XPPINode       = filterNodes XN.isPi-typeTest XPTextNode     = filterNodes XN.isText---- |--- the filter selects the NTree part of a navigable tree and--- tests whether the node is of the necessary type------    * 1.parameter fct :  filter function from the XmlTreeFilter module which tests the type of a node----filterNodes :: (XNode -> Bool) -> XPathFilter-filterNodes fct (XPVNode ns)-    = XPVNode ([n | n@(NT (NTree node _) _ _ _) <- ns , fct node])-filterNodes _ _-    = XPVError "Call to filterNodes without a nodeset"---- |--- evaluates a boolean expression, the evaluation is non-strict-boolEval :: Env -> Context -> Op -> [Expr] -> XPathFilter-boolEval _ _ op [] _-    = XPVBool (op==And)-boolEval env cont Or (x:xs) ns-    = case xboolean cont env [evalExpr env cont x ns] of-        e@(XPVError _) -> e-        XPVBool True   -> XPVBool True-        _              -> boolEval env cont Or xs ns--boolEval env cont And (x:xs) ns-    = case xboolean cont env [evalExpr env cont x ns] of-        e@(XPVError _) -> e-        XPVBool True   -> boolEval env cont And xs ns-        _              -> XPVBool False-boolEval _ _ _ _ _-    = XPVError "Call to boolEval with a wrong argument"------ |--- returns the value of a variable-getVariable :: Env -> VarName -> XPathFilter-getVariable env name _-    = case lookup name (getVarTab env) of-        Nothing -> XPVError ("Variable: " ++ show name ++ " not found")-        Just v  -> v----- |--- evaluates a function, --- computation is done by 'XPathFct.evalFct' which is defined in "XPathFct".-fctEval :: Env -> Context -> FctName -> [Expr] -> XPathFilter-fctEval env cont name args-    = evalFct name env cont . evalExprL env cont args------ |--- evaluates an arithmetic operation.------   1.parameter f :  arithmetic function from "XPathArithmetic"----numEval :: (Op -> XPathValue -> XPathValue -> XPathValue) -> Op -> [XPathValue] -> XPathValue-numEval f op = foldl1 (f op)------ |--- Convert list of ID attributes from DTD into a space separated 'XPVString'-----idAttributesToXPathValue	:: XmlTrees -> XPathValue-idAttributesToXPathValue ts-    = XPVString (foldr (\ n -> ( (valueOfDTD a_value n ++ " ") ++)) [] ts)---- |--- Extracts all ID-attributes from the document type definition (DTD).-----getIdAttributes	:: XmlTree -> XmlTrees-getIdAttributes-    = runLA $-      AT.getChildren-      >>>-      isDTD-      >>>-      AT.deep (isIdAttrType)---- ------------------------------------------isIdAttrType		:: ArrowDTD a => a XmlTree XmlTree-isIdAttrType		= hasDTDAttrValue a_type (== k_id)--valueOfDTD		:: String -> XmlTree -> String-valueOfDTD n		= concat . runLA ( getDTDAttrl >>^ lookup1 n )--hasDTDAttrValue		:: ArrowDTD a => String -> (String -> Bool) -> a XmlTree XmlTree-hasDTDAttrValue	an p	= filterA $-			  getDTDAttrl >>> isA (p . lookup1 an)---- ------------------------------------------------------------
− src/Text/XML/HXT/XPath/XPathFct.hs
@@ -1,887 +0,0 @@--- --------------------------------------------------------------{- |-   Module     : Text.XML.HXT.XPath.XPathFct-   Copyright  : Copyright (C) 2008 Uwe Schmidt-   License    : MIT--   Maintainer : Uwe Schmidt (uwe@fh-wedel.de)-   Stability  : experimental-   Portability: portable--   The module contains the core-functions of the XPath function library.-   All functions are implemented as XFct. Each XFct contains the evaluation context,-   the variable environment and the function arguments.---}---- --------------------------------------------------------------module Text.XML.HXT.XPath.XPathFct-    ( XFct-    , evalFct-    , toXValue-    , xnumber-    , xboolean-    , xstring-    , getConvFct-    , stringValue-    , remDups-    , isNotInNodeList-    , createDocumentOrder-    , createDocumentOrderReverse-    , getVarTab-    , getKeyTab-    )-where--import Text.XML.HXT.XPath.XPathDataTypes-import Text.XML.HXT.XPath.XPathParser-    ( parseNumber-    )-import Text.XML.HXT.XPath.XPathArithmetic-    ( xPathAdd-    )--import Control.Arrow				( (>>>), (<+>) )-import Control.Arrow.ArrowList			( constA )-import Control.Arrow.ArrowIf    		( ifA )-import Control.Arrow.ArrowTree			( deep )-import Control.Arrow.ListArrow			( LA, runLA )-import Text.XML.HXT.Arrow.XmlArrow-import Text.XML.HXT.Arrow.ReadDocument		(readDocument)-import Text.XML.HXT.Arrow.XmlIOStateArrow	(runX)--import           Text.XML.HXT.DOM.Interface-import qualified Text.XML.HXT.DOM.XmlNode as XN--import System.IO.Unsafe-    ( unsafePerformIO-    )--import Data.Char-    ( isAscii-    , isUpper-    , isLower-    , isDigit-    , ord-    )--import Data.List-    ( sortBy-    )--import Data.Maybe---- --------------------------------------------------------------------------------- added by Tim Walkenhorst to fix Pos0 vs. Float 0.0 problems...--int2XPNumber :: Int -> XPNumber-int2XPNumber 0 = Pos0-int2XPNumber i = Float $ fromIntegral i---- |--- Type signature for all functions which can be used in the XPath module.--type XFct = (Context -> Env -> [XPathValue] -> XPathValue)---- |--- All functions are stored in a function table.--type FctTable = [(FctName, FctTableElem)]---- |--- Each table entry consists of the function and the expected function arguments.--type FctTableElem = (XFct, CheckArgCount)---- |--- Tests whether the number of current function arguments is correct--type CheckArgCount = ([XPathValue] -> Bool)--zero, zeroOrOne, one, two, twoOrM, twoOrThree, three :: CheckArgCount-zero ex       = length ex == 0-zeroOrOne ex  = length ex == 0 || length ex == 1-one ex        = length ex == 1-two ex        = length ex == 2-twoOrM ex     = length ex >= 2-twoOrThree ex = length ex == 2 || length ex == 3-three ex      = length ex == 3----- |--- The core-functions library--fctTable :: FctTable-fctTable = [-            ("last", (xlast, zero)), -- nodeset functions-            ("position",(xposition, zero)),-            ("count",(xcount, one)),-            ("id", (xid, one)),-            ("local-name", (xlocalName, zeroOrOne)),-            ("namespace-uri", (xnamespaceUri, zeroOrOne)),-            ("name", (xname, zeroOrOne)),--            ("string", (xstring, zeroOrOne)), -- string functions-            ("concat", (xconcat, twoOrM)),-            ("starts-with",(xstartsWith, two)),-            ("contains", (xcontains, two)),-            ("substring-before", (xsubstringBefore, two)),-            ("substring-after", (xsubstringAfter, two)),-            ("substring", (xsubstring, twoOrThree)),-            ("string-length", (xstringLength, zeroOrOne)),-            ("normalize-space", (xnormalizeSpace, zeroOrOne)),-            ("translate", (xtranslate, three)),--            ("boolean", (xboolean, one)), -- boolean functions-            ("not", (xnot, one)),-            ("true", (xtrue, zero)),-            ("false",(xfalse, zero)),-            ("lang", (xlang, one)),--            ("number",(xnumber, zeroOrOne)), -- number functions-            ("sum",(xsum, one)),-            ("floor",(xfloor, one)),-            ("ceiling",(xceiling, one)),-            ("round",(xround, one)),-            ("key",(xkey, two)),-            ("format-number",(xformatNumber, twoOrThree)),-            -            ("document", (xdocument, one)),-- extension functions for xslt 1.0-            ("generate-id", (xgenerateId, zeroOrOne))-            -           ]---- --------------------------------------------------------------------------------- some helper functions---- |--- Returns the table of keys, needed by xslt, from the environment--getKeyTab :: Env -> KeyTab-getKeyTab (_, keyTab) = keyTab----- |--- Returns the table of variables from the environment--getVarTab :: Env -> VarTab-getVarTab (varTab, _) = varTab----- |--- Returns the conversion function for the XPath results: string, boolean and number--- A nodeset can not be converted.--getConvFct :: XPathValue -> Maybe XFct-getConvFct (XPVNumber _) = Just xnumber-getConvFct (XPVString _) = Just xstring-getConvFct (XPVBool _)   = Just xboolean-getConvFct _             = Nothing----- |--- Filter for ordering a list of Nodes in document order--createDocumentOrder :: XPathFilter-createDocumentOrder (XPVNode n) = XPVNode (sortBy documentOrder n)-      where-      documentOrder :: NavXmlTree -> NavXmlTree -> Ordering-      documentOrder a b = compare (documentPos a) (documentPos b)--createDocumentOrder e@(XPVError _) = e-createDocumentOrder _ = XPVError "Call to createDocumentOrder without a nodeset"----- |--- Filter for ordering a list of Nodes in reverse document order--createDocumentOrderReverse :: XPathFilter-createDocumentOrderReverse (XPVNode n) = XPVNode (sortBy documentOrderReverse n)-      where-      documentOrderReverse :: NavXmlTree -> NavXmlTree -> Ordering-      documentOrderReverse a b = compare (documentPos b) (documentPos a)--createDocumentOrderReverse e@(XPVError _) = e-createDocumentOrderReverse _              = XPVError "Call to createDocumentOrderReverse without a nodeset"---- |--- Filter for removing identical fragment trees in a nodeset--remDups :: XPathFilter-remDups e@(XPVError _) = e-remDups (XPVNode []) = XPVNode []-remDups (XPVNode (x:xs))-    | isNotInNodeList x xs = XPVNode (x : y)-    | otherwise            = remDups (XPVNode xs)-      where-      (XPVNode y) = remDups (XPVNode xs)-remDups _ = XPVError "Call to remDups without a nodeset"---- |--- Check whether a node is not a part of a node list. Needed to implement matching & testing in xslt.--isNotInNodeList :: NavXmlTree -> [NavXmlTree] -> Bool-isNotInNodeList n xs' = nodeID (Just n) `notElem` map (nodeID . Just) xs'----- |--- calculate an ID for a NODE------    - returns : a list of numbers, one number for each level of the tree---- Tim Walkenhorst:---   - Attributes are identified by their QName (they do not have previous siblings)---   - Elements are identified by their relative position (# of previous siblings)--data IdPathStep = IdRoot String | IdPos Int | IdAttr QName deriving (Show, Eq, Ord)--nodeID :: Maybe (NavXmlTree) -> [IdPathStep]-nodeID Nothing = []-nodeID (Just t@(NT (NTree (XAttr qn) _)  _ _ _)) = IdAttr qn : nodeID (upNT t)-nodeID (Just t@(NT node _ prev _))               -   | XN.isRoot node-       = return $ IdRoot (getRootId node) -   | otherwise-       = IdPos (length prev) : nodeID (upNT t)-   where-   getRootId	= concat . runLA (getAttrValue "rootId")---- |--- Calculates the position of a node in a tree (in document order)--documentPos :: NavXmlTree -> [IdPathStep]-documentPos tree = reverse $ nodeID (Just tree)----- |--- Evaluates a function.--- Calculation of the function value is done by looking up the function name in the function table,--- check the number of arguments and calculate the funtion, if no--- argument evaluation returns an error.------    - returns : the function value as 'XPathValue'--evalFct :: FctName -> Env -> Context -> [XPathValue] -> XPathValue-evalFct name env cont args-    = case (lookup name fctTable) of-        Nothing -> XPVError ("Call to undefined function "++ name)-        Just (fct, checkArgCount) ->-          if not (checkArgCount args)-            then XPVError ("Call to function "++ name ++ " with wrong arguments")-            else case (checkArgErrors args) of-                   Just e  -> e-                   Nothing -> fct cont env args-      where-      checkArgErrors [] = Nothing-      checkArgErrors ((XPVError r):_) = Just (XPVError r)-      checkArgErrors (_:xs) = checkArgErrors xs----- |--- Converts a list of different 'XPathValue' types in a list of one 'XPathValue' type.------    * 1.parameter fct :  the conversion function-----toXValue :: XFct -> Context -> Env -> [XPathValue] -> [XPathValue]-toXValue fct c env args = [fct c env [x] | x <- args]----- -------------------------------------------------------------------------------- core-funktions library---- nodeset functions---- |--- number last(): returns a number equal to the context size from the expression evaluation context--xlast :: XFct-xlast (_, len , _) _ _ = XPVNumber $ int2XPNumber len----- |--- number position(): returns a number equal to the context position from the expression evaluation context--xposition :: XFct-xposition (pos, _ , _) _ _ = XPVNumber $ int2XPNumber pos----- |--- number count(node-set): returns the number of nodes in the argument node-set--xcount :: XFct-xcount _ _ [XPVNode ns] = XPVNumber $ int2XPNumber $ length ns-xcount _ _ _ = XPVError "Call to function count with wrong arguments"----- |--- node-set id(object): selects elements by their unique ID--xid :: XFct-xid (_, _, cn) env [XPVNode ns]-    = isInId  (getIds env) (strValues ns) [cn]-      where-      strValues = map ((\ (XPVString str) -> str) . stringValue)--xid c@(_, _, cn) env arg-    = isInId (getIds env) ( (\(XPVString s) -> words s) (xstring c env arg)) [cn]------ |--- returns all IDs from the variable environment as a list of strings.--- the IDs are stored in the variable: idAttr--getIds :: Env -> [String]-getIds env--- hier muss noch auf prefix getestet werden-    = words $ (\ (XPVString str) -> str) . fromJust $ lookup ("", "idAttr") $ getVarTab env ---isInId :: [String] -> [String] -> NavXmlTrees -> XPathValue-isInId ids str ns-    = remDups (XPVNode (concat $ map (filterNS ids str . descendantOrSelfAxis) ns))---filterNS :: [String] -> [String] -> NavXmlTrees -> NavXmlTrees-filterNS ids str ns-    = [ n | n@(NT a@(NTree _ _) _ _ _) <- ns, or $ map (idInIdList a str) ids]-      where-      idInIdList :: XmlTree -> [String] -> String -> Bool-      idInIdList al str' b = (getValue b al) `elem` str'----- |--- string local-name(node-set?):--- returns the local part of the expanded-name of the node in the argument node-set--- that is first in document order. --- If the argument node-set is empty or the first node has no expanded-name, an empty string is returned. --- If the argument is omitted, it defaults to a node-set with the context node as its only member----   Bugfix: name(\/) is "" not "\/"!--xlocalName :: XFct-xlocalName (_, _, cn) _ []  = XPVString (xpLocalPartOf $ subtreeNT cn)-xlocalName _ _ [XPVNode []] = XPVString ""-xlocalName _ _ [XPVNode ns] = XPVString (xpLocalPartOf $ subtreeNT $ head $ ns)-xlocalName _ _ _            = XPVError "Call to function local-name with wrong arguments"---- |--- string namespace-uri(node-set?):--- returns the namespace URI of the expanded-name of the node in the argument node-set--- that is first in document order.--- If the argument node-set is empty, the first node has no expanded-name,--- or the namespace URI of the expanded-name--- is null, an empty string is returned. If the argument is omitted,--- it defaults to a node-set with the context node as its only member--xnamespaceUri :: XFct-xnamespaceUri (_, _, cn) _ []  = XPVString (xpNamespaceOf $ subtreeNT cn)-xnamespaceUri _ _ [XPVNode []] = XPVString ""-xnamespaceUri _ _ [XPVNode ns] = XPVString (xpNamespaceOf $ subtreeNT $ head $ ns)-xnamespaceUri _ _ _            = XPVError "Call to function namespace-uri with wrong arguments"----- |--- string name(node-set?): --- returns a string containing a QName representing the expanded-name of the node--- in the argument node-set --- that is first in document order. If the argument node-set is empty or the first--- node has no expanded-name, --- an empty string is returned. If the argument it omitted, it defaults to a node-set--- with the context node as its only member.--- Tim Walkenhorst: ----   Bugfix: name(\/) is "" not "\/"!--xname :: XFct-xname (_, _, cn) _ []  =  XPVString (xpNameOf $ subtreeNT cn)-xname _ _ [XPVNode []] = XPVString ""-xname _ _ [XPVNode ns] = XPVString (xpNameOf $ subtreeNT $ head $ ns)-xname _ _ _            = XPVError "Call to function name with wrong arguments"---- --------------------------------------------------------------- string functions---- |--- some helper functions-getFirstPos :: String -> String -> Int-getFirstPos s sub-    = if (getFirstPos' s sub) > length s-        then -1-        else getFirstPos' s sub--getFirstPos' :: String -> String -> Int-getFirstPos' [] _ = 2-getFirstPos' (x:xs) sub-    = if strStartsWith (x:xs) sub-      then 0-      else 1 + getFirstPos' xs sub--strStartsWith :: String -> String -> Bool-strStartsWith a b-    = take (length b) a == b------ |--- Returns the string-value of a node,--- the value of a namespace node is not supported--stringValue :: NavXmlTree -> XPathValue-stringValue (NT a _ _ _)-    = XPVString $ xpTextOf a--{--      textFilter -        = getXCmt `orElse`---        getXNamespace `orElse`-          multi isXText-         ---        = (isXTag `guards` multi isXText) `orElse`---          (isXPi `guards` multi isXText) `orElse`---          (isXAttr `guards` multi isXText) `orElse`          ---          (isXText `guards` multi isXText) `orElse`---          getXCmt--}----- |--- string string(object?): converts an object to a string--xstring :: XFct-xstring _ _ [XPVNode []]           = XPVString ""-xstring _ _ [XPVNode (x:_)]        = stringValue x-xstring (_, _, cn) _ []            = stringValue cn--xstring _ _ [XPVNumber (Float a)]-    | a == (fromInteger $ round a) = XPVString (show ((round a)::Integer))-    | otherwise                    = XPVString (show a)-xstring _ _ [XPVNumber s]          = XPVString (show s)--xstring _ _ [XPVBool True]         = XPVString "true"-xstring _ _ [XPVBool False]        = XPVString "false"--xstring _ _ [XPVString s]          = XPVString s-xstring _ _ [XPVError e]           = XPVError e-xstring _ _ _                      = XPVError "Call to xstring with a wrong argument"------ |--- string concat(string, string, string*): returns the concatenation of its arguments--xconcat :: XFct-xconcat c env args -    = XPVString (foldr (\ (XPVString s) -> (s ++)) "" (toXValue xstring c env args))----- |--- boolean starts-with(string, string): --- returns true if the first argument string starts --- with the second argument string, and otherwise returns false--xstartsWith :: XFct-xstartsWith c env args-    = XPVBool ( (\ ((XPVString a):[XPVString b]) -> strStartsWith a b) (toXValue xstring c env args))----- |--- boolean contains(string, string):--- returns true if the first argument string contains the second argument string,--- and otherwise returns false--xcontains :: XFct-xcontains c env args-    = XPVBool ( (\ ((XPVString s):[XPVString sub]) -> getFirstPos s sub /= -1) (toXValue xstring c env args))----- |--- string substring-before(string, string):--- returns the substring of the first argument string that precedes the first occurrence of--- the second argument string --- in the first argument string, or the empty string if the first argument string does not--- contain the second argument string--xsubstringBefore :: XFct-xsubstringBefore c env args-    = xsubstringBefore' c env (toXValue xstring c env args)--xsubstringBefore' :: XFct-xsubstringBefore' _ _ ((XPVString _):[XPVString []]) = XPVString ""-xsubstringBefore' _ _ ((XPVString s):[XPVString sub]) = XPVString (take (getFirstPos s sub) s)-xsubstringBefore' _ _ _ = XPVError "Call to xsubstringBefore' with a wrong argument"------- |--- string substring-after(string, string):--- returns the substring of the first argument string that follows the first occurrence of--- the second argument string --- in the first argument string, or the empty string if the first argument string does not--- contain the second argument string--xsubstringAfter :: XFct-xsubstringAfter c env args-    = xsubstringAfter' c env (toXValue xstring c env args)--xsubstringAfter' :: XFct-xsubstringAfter' _ _ ((XPVString s):[XPVString []])-    = XPVString s-xsubstringAfter' _ _ ((XPVString s):[XPVString sub])-    = if getFirstPos s sub == -1-        then (XPVString "")-        else XPVString (drop ((getFirstPos s sub)+length sub) s)-xsubstringAfter' _ _ _ -    = XPVError "Call to xsubstringAfter' with a wrong argument"----- |--- string substring(string, number, number?):--- returns the substring of the first argument starting at the position specified--- in the second argument --- with length specified in the third argument. If the third argument is not specified,--- it returns the substring --- starting at the position specified in the second argument and continuing to the end of the string.--xsubstring :: XFct-xsubstring c env (x:xs)-    = xsubstring' c env ((toXValue xstring c env [x])++(toXValue xnumber c env xs))-xsubstring _ _ _-    = XPVError "Call to xsubstring with a wrong argument"--xsubstring' :: XFct-xsubstring' c env ((XPVString s):start:[])-    = case xround c env [start] of-        XPVNumber NaN       -> XPVString ""-        XPVNumber PosInf    -> XPVString ""-        XPVNumber (Float f) -> XPVString (drop ((round f)-1) s)-        XPVNumber _         -> XPVString s-        _                   -> XPVError "Call to xsubstring' with a wrong argument"--xsubstring' c env ((XPVString s):start:[end])-    = case xPathAdd Plus (xround c env [start]) (xround c env [end]) of-        XPVNumber (Float f) -> xsubstring' c env ( (XPVString (take ((round f) -1) s)):[start])-        XPVNumber PosInf    -> xsubstring' c env ( (XPVString s):[start])-        XPVNumber _         -> XPVString ""-        _                   -> XPVError "Call to xsubstring' with a wrong argument"-xsubstring' _ _ _-    = XPVError "Call to xsubstring' with a wrong argument"----- |--- number string-length(string?):--- returns the number of characters in the string. If the argument is omitted,--- it defaults to the context node --- converted to a string, in other words the string-value of the context node.--xstringLength :: XFct-xstringLength c@(_, _, cn) env []-    = XPVNumber (Float (fromIntegral $ length s))-      where (XPVString s) = xstring c env [XPVNode [cn]]-xstringLength c env args-    = XPVNumber $ (\[XPVString s] -> int2XPNumber $ length s) (toXValue xstring c env args)----- |--- string normalize-space(string?):--- returns the argument string with whitespace normalized by stripping leading--- and trailing whitespace and replacing sequences --- of whitespace characters by a single space. If the argument is omitted,--- it defaults to the context node converted to a string, --- in other words the string-value of the context node.--- The string is parsed by a function parseStr from XPathParser module. <-- No longer! Tim Walkenhorst--xnormalizeSpace :: XFct-xnormalizeSpace c@(_, _, cn) env []-    = (\(XPVString s) -> XPVString $ normStr s) (xstring c env [XPVNode [cn]])-xnormalizeSpace c env args-    = (\ [XPVString s] -> XPVString $ normStr s) (toXValue xstring c env args)---- Tim Walkenhorst normStr replaces the use of parseStr...-normStr :: String -> String-normStr = unwords . words---- |--- string translate(string, string, string):--- returns the first argument string with occurrences of characters in the second argument string replaced by the character at --- the corresponding position in the third argument string-xtranslate :: XFct-xtranslate c env args-    = xtranslate' c env (toXValue xstring c env args)--xtranslate' :: XFct-xtranslate' _ _ ((XPVString a):(XPVString b):[XPVString c])-    = XPVString (replace a b c)-xtranslate' _ _ _-    = XPVError "Call to xtranslate' with a wrong argument"--replace :: String -> String -> String -> String-replace str [] _ = str---- remove all characters, if there is no corresponding character in the third argument-replace str (x:xs) []-    = replace [ s | s <- str, x /= s] xs []--replace str (x:xs) (y:ys)-    = replace (rep x y str) xs ys-      where -- replace all characters in the first argument-      rep :: Char -> Char -> String -> String-      rep a b = foldr (\c -> if c == a then (b:) else (c:)) ""----- --------------------------------------------------------------- boolean functions---- |--- boolean boolean(object): converts its argument to a boolean value-xboolean :: XFct-xboolean _ _ [XPVNumber a] = XPVBool (a/= NaN && a/= Neg0 && a/= Pos0)-xboolean _ _ [XPVString s] = XPVBool (length s /= 0)-xboolean _ _ [XPVBool b]   = XPVBool b-xboolean _ _ [XPVNode ns]  = XPVBool (length ns > 0)-xboolean _ _ [XPVError e]  = XPVError e-xboolean _ _ _             = XPVError "Call to xboolean with a wrong argument"----- |--- boolean not(boolean): returns true if its argument is false, and false otherwise-xnot :: XFct-xnot c env args-    = XPVBool ( (\ (XPVBool b) -> not b) (xboolean c env args) )----- |--- boolean true(): returns true-xtrue :: XFct-xtrue _ _ _ = XPVBool True----- |--- boolean false(): returns false-xfalse :: XFct-xfalse _ _ _ = XPVBool False----- |--- boolean lang(string):--- returns true or false depending on whether the language of the context node as specified by xml:lang attributes --- is the same as or is a sublanguage of the language specified by the argument string---- function needs namespaces which are not supported by the toolbox-xlang :: XFct-xlang _ _ _-    = XPVError "namespaces are not supported"---- xlang c env args---    = (\ (_, _, cn) [XPVString s] -> ...) c (toXValue xstring c env args)------ --------------------------------------------------------------- number functions---- |--- number number(object?): converts its argument to a number-xnumber :: XFct-xnumber c@(_, _, cn) env []-    = (\(XPVString s) -> parseNumber s) (xstring c env [XPVNode [cn]])-xnumber c env [n@(XPVNode _)]-    = (\(XPVString s) -> parseNumber s) (xstring c env [n])--xnumber _ _ [XPVBool b]-    | b                   = XPVNumber (Float 1)-    | otherwise           = XPVNumber Pos0--xnumber _ _ [XPVString s] = parseNumber s-xnumber _ _ [XPVNumber a] = XPVNumber a-xnumber _ _ [XPVError e]  = XPVError e-xnumber _ _ _             = XPVError "Call to xnumber with a wrong argument"----- |--- number sum(node-set): --- returns the sum, for each node in the argument node-set, of the result of --- converting the string-values of the node to a number-xsum :: XFct-xsum _ _ [XPVNode []] = XPVNumber NaN-xsum c env [XPVNode ns]-    = foldr1 (\ a b -> (xPathAdd Plus a b)) (getValues ns)-      where-      getValues :: NodeSet -> [XPathValue]-      getValues = foldr (\ n -> ([xnumber c env $ [stringValue n] ] ++) ) []--xsum _ _ _-    = XPVError "The value of the function sum is not a nodeset"---- |--- number floor(number): returns the largest (closest to positive infinity) number that is not greater --- than the argument and that is an integer-xfloor :: XFct-xfloor c env args-    = xfloor' (toXValue xnumber c env args)-      where-      xfloor' [XPVNumber (Float f)]-        | f > 0 && f < 1    = XPVNumber Pos0-        | otherwise         = XPVNumber (Float (fromInteger $ floor f))-      xfloor' [XPVNumber a] = XPVNumber a-      xfloor' _             = XPVError "Call to xfloor' without a number"----- |--- number ceiling(number): returns the smallest (closest to negative infinity) number that is not less --- than the argument and that is an integer-xceiling  :: XFct-xceiling c env args-    = xceiling' (toXValue xnumber c env args)-      where-      xceiling' [XPVNumber (Float f)]-        | f < 0 && f > -1     = XPVNumber Pos0-        | otherwise           = XPVNumber (Float (fromInteger $ ceiling f))-      xceiling' [XPVNumber a] = XPVNumber a-      xceiling' _             = XPVError "Call to xceiling' without a number"---- |--- number round(number):--- returns the number that is closest to the argument and that is an integer. --- If there are two such numbers, then the one that is closest to positive infinity is returned.-xround :: XFct-xround c env args-    = xround' c env (toXValue xnumber c env args)--xround' :: XFct-xround' _ _ [XPVNumber (Float f)]-    | f < 0 && f >= -0.5  = XPVNumber Neg0-    | f >= 0 && f < 0.5   = XPVNumber Pos0-    | otherwise           = XPVNumber (Float (fromInteger $ xPathRound f))-      where-      xPathRound a -        = if a - (fromInteger $ floor a) < 0.5-            then floor a-            else floor (a+1)--xround' _ _ [XPVNumber a] = XPVNumber a-xround' _ _ _             = XPVError "Call to xround' without a number"------ |--- node-set key(string, object):--- does for keys what the id function does for IDs--- The first argument specifies the name of the key.--- When the second argument is of type node-set, then the result is the--- union of the result of applying the key function to the string value--- of each of the nodes in the argument node-set.--- When the second argument is of any other type, the argument is--- converted to a string -xkey :: XFct-xkey _ env ((XPVString s) : [XPVNode ns])-    = isInKey (getKeyTab env) s (strValues ns)-      where-      strValues = map ((\ (XPVString str) -> str) . stringValue)--xkey c env ((XPVString s) : arg)-    -- = isInKey (getKeyTab env) s  ( (\(XPVString s) -> words s) (xstring c env arg))-    = isInKey (getKeyTab env) s [str]-      where-        (XPVString str) = xstring c env arg--xkey _ _ _ = XPVError "Call to xkey with a wrong argument"---isInKey :: KeyTab -> String -> [String] -> XPathValue-isInKey kt kn kv-    -- = remDups (XPVNode (map ntree ts) )-    = XPVNode ts --(map ntree ts)-      where-        (_, _, ts) = unzip3 $ concat $ map (isKeyVal (isKeyName kt kn)) kv--isKeyName :: KeyTab -> String -> KeyTab-isKeyName kt kn = filter (isOfKeyName kn) kt--isKeyVal :: KeyTab -> String -> KeyTab-isKeyVal kt kv = filter (isOfKeyValue kv) kt--isOfKeyName :: String -> (QName, String, NavXmlTree) -> Bool-isOfKeyName kn (qn, _, _) = (localPart qn) == kn---isOfKeyValue :: String -> (QName, String, NavXmlTree) -> Bool-isOfKeyValue kv (_, v, _)   = v == kv----- |--- string format-number(number, string, string?):--- converts its first argument to a string using the format pattern string--- specified by the second argument and the decimal-format named by the--- third argument, or the default decimal-format, if there is no third argument--xformatNumber :: XFct-xformatNumber c env (x:xs)-    = xsubstring' c env ((toXValue xstring c env [x])++(toXValue xnumber c env xs))-xformatNumber _ _ _-    = XPVError "Call to xformatNumber with a wrong argument"----- Poor man's document(...) function. Opens exactly one document. --- Does not support "fragment identifiers". "Base-URI" is always current directory.--- Should still be good enough for home use.--xdocument :: XFct-xdocument c e val = XPVNode $ (\(XPVString s) -> xdocument' s) $ xstring c e val--xdocument' :: String -> [NavXmlTree]-xdocument' uri = map ntree $-		 unsafePerformIO $-		 runX ( readDocument [(a_validate, v_0)] uri-			>>>-			addAttr "rootId" ("doc " ++ uri)-		      )---- generate-id, should be fully compliant with XSLT specification.-xgenerateId :: XFct-xgenerateId _            _ [XPVNode (node:_)] = xgenerateId' node-xgenerateId (_, _, node) _ []                 = xgenerateId' node-xgenerateId _            _ _                  = error "illegal arguments in xgenerateId"--xgenerateId' :: NavXmlTree -> XPathValue-xgenerateId' = XPVString . ("id_"++) . str2XmlId . show . nodeID . Just--str2XmlId :: String -> String-str2XmlId = concatMap convert-    where convert c = if isAscii c && (isUpper c || isLower c || isDigit c)-                      then [c]-                      else "_" ++ (show $ ord c) ++ "_"---- --------------------------------------------------------------xpNamePart :: LA XmlTree String -> XmlTree -> String-xpNamePart getNp-    = concat-      .-      runLA ( ifA isRoot-	      (constA "")-	      getNp-	    )--xpLocalPartOf	:: XmlTree -> String-xpLocalPartOf	= xpNamePart getLocalPart--xpNamespaceOf	:: XmlTree -> String-xpNamespaceOf	= xpNamePart getNamespaceUri--xpNameOf	:: XmlTree -> String-xpNameOf	= xpNamePart getName--getValue	:: String -> XmlTree -> String-getValue n	= concat . runLA (getAttrValue n)--xpTextOf	:: XmlTree -> String-xpTextOf	= concat . runLA (xshow ((getCmt >>> mkText) <+> deep isText))---- ------------------------------------------------------------
− src/Text/XML/HXT/XPath/XPathKeywords.hs
@@ -1,57 +0,0 @@--- |--- $Id: XPathKeywords.hs,v 1.1 2004/09/02 19:12:05 hxml Exp $------ the XPath keywords------module Text.XML.HXT.XPath.XPathKeywords-where---- ------------------------------------------------------------------ string constants for representing XPath keywords and axis--a_ancestor,			-- axisNames- a_ancestor_or_self,- a_attribute,- a_child,- a_descendant,- a_descendant_or_self,- a_following,- a_following_sibling,- a_namespace,- a_parent,- a_preceding,- a_preceding_sibling,- a_self				:: String---n_comment,			-- nodeTypes- n_text,- n_processing_instruction,- n_node				:: String---- --------------------------------------------------------------a_ancestor			= "ancestor"  -a_ancestor_or_self		= "ancestor-or-self"  -a_attribute 			= "attribute"  -a_child				= "child"  -a_descendant			= "descendant"  -a_descendant_or_self		= "descendant-or-self"  -a_following			= "following"  -a_following_sibling		= "following-sibling"  -a_namespace			= "namespace"  -a_parent			= "parent"  -a_preceding			= "preceding"  -a_preceding_sibling		= "preceding-sibling"  -a_self				= "self" ---n_comment 			= "comment"-n_text 				= "text"-n_processing_instruction 	= "processing-instruction"-n_node 				= "node"---- ------------------------------------------------------------
− src/Text/XML/HXT/XPath/XPathParser.hs
@@ -1,652 +0,0 @@--- --------------------------------------------------------------{- |-   Module     : Text.XML.HXT.XPath.XPathParser-   Copyright  : Copyright (C) 2006-2008 Uwe Schmidt-   License    : MIT--   Maintainer : Uwe Schmidt (uwe@fh-wedel.de)-   Stability  : experimental-   Portability: portable--   the XPath Parser---}---- --------------------------------------------------------------module Text.XML.HXT.XPath.XPathParser-    ( parseNumber-    , parseXPath-    )-where--import Data.Maybe--import Text.ParserCombinators.Parsec--import Text.XML.HXT.DOM.TypeDefs--import Text.XML.HXT.XPath.XPathKeywords-import Text.XML.HXT.XPath.XPathDataTypes--import Text.XML.HXT.Parser.XmlTokenParser-    ( separator-    , systemLiteral-    , skipS0-    , ncName-    , qName-    )--lookupNs				:: NsEnv -> XName -> XName-lookupNs uris prefix-					-- downwards compatibility: if namespace env is not supported-					-- no error is raised, but the uri remains empty-					-- not conformant to XPath spec:-					-- If namespaces are used, a complete env must be supported,-					-- but we don't care about this-					= fromMaybe nullXName $ lookup prefix uris--enhanceAttrQName			:: NsEnv -> QName -> QName-enhanceAttrQName uris qn-    | isNullXName (namePrefix' qn)	= qn-    | otherwise				= enhanceQName uris qn--enhanceQName 				:: NsEnv -> QName -> QName-enhanceQName uris qn			= setNamespaceUri' ( lookupNs uris (namePrefix' qn) ) qn--enhanceQN				::  AxisSpec -> NsEnv -> QName -> QName-enhanceQN Attribute			= enhanceAttrQName-enhanceQN _				= enhanceQName--type XParser a = GenParser Char NsEnv a---- --------------------------------------------------------------- parse functions which are used in the XPathFct module---- |--- parsing a number, parseNumber is used in "XPathFct"--- by the number function------    - returns : the parsed number as 'XPNumber' float---                or 'XPVNumber' 'NaN' in case of error-parseNumber :: String -> XPathValue-parseNumber s-    = case (runParser parseNumber' [] {- Map.empty -} "" s) of-        Left _ -> XPVNumber NaN-        Right x  -> if (read x :: Float) == 0-                      then (XPVNumber Pos0)-                      else XPVNumber (Float (read x))--parseNumber' :: XParser String-parseNumber'-    = do-      skipS0-      m <- option "" (string "-")-      n <- number-      skipS0-      eof-      return (m ++ n)---- ----------------------------------------------------------------- |--- the main entry point:--- parsing a XPath expression--parseXPath :: XParser Expr-parseXPath-    = do-      skipS0-      xPathExpr <- expr-      skipS0-      eof-      return xPathExpr----- some useful token and symbol parser-lpar, rpar, lbra, rbra, slash, dslash	:: XParser ()--lpar   = tokenParser (symbol "(")-rpar   = tokenParser (symbol ")")-lbra   = tokenParser (symbol "[")-rbra   = tokenParser (symbol "]")-slash  = tokenParser (symbol "/")-dslash = tokenParser (symbol "//")---tokenParser :: XParser String -> XParser ()-tokenParser p-    = try ( do-            skipS0-            _ <- p-            skipS0-           )---symbolParser :: (String, a) -> XParser a-symbolParser (s,a)-    = do-      tokenParser (symbol s)-      return a---symbol :: String -> XParser String-symbol s = try (string s)------  operation parser-orOp, andOp, eqOp, relOp, addOp, multiOp, unionOp :: XParser Op--orOp  = symbolParser ("or", Or)-andOp =	symbolParser ("and", And)--eqOp-    = symbolParser ("=", Eq)-      <|> -      symbolParser ("!=", NEq)--relOp-    = choice [ symbolParser ("<=", LessEq)-             , symbolParser (">=", GreaterEq)-             , symbolParser ("<", Less)-             , symbolParser (">", Greater)-             ]--addOp-    = symbolParser ("+", Plus)-      <|> -      symbolParser ("-", Minus)---multiOp-    = choice [ symbolParser ("*", Mult)-             , symbolParser ("mod", Mod)-             , symbolParser ("div", Div)-             ]---unionOp	= symbolParser ("|", Union)---- --------------------------------------------------------------mkExprNode :: Expr -> [(Op, Expr)] -> Expr-mkExprNode e1 [] = e1-mkExprNode e1 l@((op, _): _) = -    if null rest-      then GenExpr op (e1:(map snd l))-      else GenExpr op $ (e1:(map snd $ init same)) ++ [mkExprNode (snd $ last same) rest]-  where -    (same, rest) = span ((==op) . fst) l-    --- Tim Walkenhorst, original expr. below:--- It seems mkExprNode is called only with operators of the same precedence, that should make it fixable--- FIXED, see above!---mkExprNode e1 l@((op, _): _) = GenExpr op (e1:(map snd l))  -- Less than ideal: 1+1-1 = 3 ???-----GenExpr op (e1:(map snd l))---exprRest :: XParser Op -> XParser Expr -> XParser (Op, Expr)-exprRest parserOp parserExpr-    = do-      op <- parserOp-      e2 <- parserExpr-      return (op, e2)----- ---------------------------------------------------------------- abbreviation of "//"-descOrSelfStep :: XStep -descOrSelfStep = (Step DescendantOrSelf (TypeTest XPNode) [])---- --------------------------------------------------------------- Location Paths (2)----- [1] LocationPath -locPath :: XParser LocationPath-locPath-    = absLocPath-      <|> -      relLocPath'----- [2] AbsoluteLocationPath-absLocPath :: XParser LocationPath-absLocPath-    = do -- [10]-      dslash-      s <- relLocPath-      return (LocPath Abs ([descOrSelfStep] ++ s))-      <|> -      do-      slash-      s <- option [] relLocPath-      return (LocPath Abs s)-      <?> "absLocPath"----- [3] RelativeLocationPath-relLocPath' :: XParser LocationPath-relLocPath'-    = do-      rel <- relLocPath-      return (LocPath Rel rel)--relLocPath :: XParser [XStep]-relLocPath-    = do-      s1 <- step-      s2 <- many (step')-      return ([s1] ++ (concat s2))-      <?> "relLocPath"----- Location Steps (2.1)------ [4] Step-step' :: XParser [XStep]-step'-    = do -- [11]-      dslash-      s <- step-      return [descOrSelfStep,s]-      <|>-      do-      slash-      s <- step-      return [s]-      <?> "step'"--step :: XParser XStep-step-    = abbrStep-      <|>-      do-      as <- axisSpecifier'-      nt <- nodeTest as-      pr <- many predicate-      return (Step as nt pr)-      <?> "step"----- [5] AxisSpecifier-axisSpecifier' :: XParser AxisSpec-axisSpecifier'-    = do  -- [13]-      tokenParser (symbol "@")-      return Attribute-      <|>-      do-      as <- option Child ( try ( do -- child-axis is default-axis-                                 a <- axisSpecifier-                                 tokenParser (symbol "::")-                                 return a-                               )-                          )-      return as-      <?> "axisSpecifier'"----- Axes (2.2)------ [6] AxisName-axisSpecifier :: XParser AxisSpec-axisSpecifier-    = choice [ symbolParser (a_ancestor_or_self, AncestorOrSelf)-             , symbolParser (a_ancestor, Ancestor)-             , symbolParser (a_attribute, Attribute)-             , symbolParser (a_child, Child)-             , symbolParser (a_descendant_or_self, DescendantOrSelf)-             , symbolParser (a_descendant, Descendant)-             , symbolParser (a_following_sibling, FollowingSibling)-             , symbolParser (a_following, Following)-             , symbolParser (a_namespace, Namespace)-             , symbolParser (a_parent, Parent)-             , symbolParser (a_preceding_sibling, PrecedingSibling)-             , symbolParser (a_preceding, Preceding)-             , symbolParser (a_self, Self)-             ]-      <?> "axisSpecifier"----- Node Tests (2.3)------ [7] NodeTest-nodeTest :: AxisSpec -> XParser NodeTest-nodeTest as-    = do-      nt <- try nodeType'-      return (TypeTest nt)-      <|>-      do-      processInst <- pI-      return (PI processInst)-      <|>-      do-      nt <- nameTest as-      return (NameTest nt)-      <?> "nodeTest"--pI :: XParser String-pI-    = do-      tokenParser (symbol n_processing_instruction)-      li <- between lpar rpar literal-      return li-      <?> "Processing-Instruction"----- Predicates (2.4)------ [8] Predicate--- [9] PredicateExpr-predicate :: XParser Expr-predicate -    = do-      ex <- between lbra rbra expr-      return ex----- Abbreviated Syntax (2.5)------ [10] AbbreviatedAbsoluteLocationPath: q.v. [2]--- [11] AbbreviatedRelativeLocationPath: q.v. [4]---- [12] AbbreviatedStep-abbrStep :: XParser XStep-abbrStep -    = do-      tokenParser (symbol "..")-      return (Step Parent (TypeTest XPNode) [])-      <|>-      do-      tokenParser (symbol ".")-      return (Step Self (TypeTest XPNode) [])-      <?> "abbrStep"---- [13] AbbreviatedAxisSpecifier: q.v. [5]----- --------------------------------------------------------------- Expressions (3)----- Basics (3.1)------ [14] Expr-expr :: XParser Expr-expr = orExpr----- [15] PrimaryExpr-primaryExpr ::  XParser Expr-primaryExpr-    = do-      vr <- variableReference-      return (VarExpr vr)-      <|>-      do-      ex <- between lpar rpar expr-      return ex-      <|>-      do-      li <- literal-      return (LiteralExpr li)-      <|> -      do-      num <- number-      return (NumberExpr (Float $ read num))-      <|>-      do-      fc <- functionCall-      return (fc)-      <?> "primaryExpr"----- Function Calls (3.2)------ [16] FunctionCall--- [17] Argument-functionCall :: XParser Expr-functionCall-    = do-      fn <- functionName-      arg <- between lpar rpar ( sepBy expr (separator ',') )-      return (FctExpr fn arg)-      <?> "functionCall"----- Node-sets (3.3)------ [18] UnionExpr-unionExpr :: XParser Expr-unionExpr-    = do-      e1 <- pathExpr-      eRest <- many (exprRest unionOp pathExpr)-      return (mkExprNode e1 eRest)----- [19] PathExpr-pathExpr :: XParser Expr-pathExpr-    = do-      fe <- try filterExpr-      path <- do-              dslash-              LocPath t1 t2 <- relLocPath'-              return (PathExpr (Just fe) (Just (LocPath t1 ([descOrSelfStep] ++ t2))))-              <|>-              do-              slash-              relPath <- relLocPath'-              return (PathExpr (Just fe) (Just relPath))-              <|>-              return fe-      return path-      <|>-      do-      lp <- locPath-      return (PathExpr Nothing (Just lp))-      <?> "pathExpr"----- [20] FilterExpr-filterExpr :: XParser Expr-filterExpr-    = do-      prim <- primaryExpr-      predicates <- many predicate-      if length predicates > 0-        then return (FilterExpr (prim : predicates))-        else return prim-      <?> "filterExpr"----- Booleans (3.4)------ [21] OrExpr-orExpr :: XParser Expr-orExpr-    = do-      e1 <- andExpr-      eRest <- many (exprRest orOp andExpr)-      return (mkExprNode e1 eRest)-      <?> "orExpr"----- [22] AndExpr-andExpr :: XParser Expr-andExpr-    = do-      e1 <- equalityExpr-      eRest <- many (exprRest andOp equalityExpr)-      return (mkExprNode e1 eRest)-      <?> "andExpr"----- [23] EqualityExpr-equalityExpr :: XParser Expr-equalityExpr-    = do-      e1 <- relationalExpr-      eRest <- many (exprRest eqOp relationalExpr)-      return (mkExprNode e1 eRest)-      <?> "equalityExpr"----- [24] RelationalExpr-relationalExpr :: XParser Expr-relationalExpr-    = do-      e1 <- additiveExpr-      eRest <- many (exprRest relOp additiveExpr)-      return (mkExprNode e1 eRest)-      <?> "relationalExpr"----- Numbers (3.5)------ [25] AdditiveExpr-additiveExpr :: XParser Expr-additiveExpr-    = do-      e1 <- multiplicativeExpr-      eRest <- many (exprRest addOp multiplicativeExpr)-      return (mkExprNode e1 eRest)-      <?> "additiveExpr"----- [26] MultiplicativeExpr-multiplicativeExpr :: XParser Expr-multiplicativeExpr-    = do-      e1 <- unaryExpr-      eRest <- many (exprRest multiOp unaryExpr)-      return (mkExprNode e1 eRest)-      <?> "multiplicativeExpr"----- [27] UnaryExpr-unaryExpr :: XParser Expr-unaryExpr-    = do-      tokenParser (symbol "-")-      u <- unaryExpr-      return (GenExpr Unary [u])-      <|>-      do-      u <- unionExpr-      return u-      <?> "unaryExpr"----- Lexical Structure (3.7)------ [29] Literal--- systemLiteral from XmlParser is used-literal :: XParser String-literal = systemLiteral----- [30] Number-number :: XParser String-number-    = do-      tokenParser (symbol ".")-      d <- many1 digit-      return ("0." ++ d)-      <|>-      do-      d <- many1 digit-      d1 <- option "" ( do-                        tokenParser (symbol ".")-                        d2 <- option "0" (many1 digit)-                        return ("." ++ d2)-                      )-      return (d ++ d1)-      <?> "number"----- [35] FunctionName--- no nodetype name is allowed as a function name--- Tim Walkenhorst:---   Change in String encoding for function name------         previoulsy:      new:---           ---         name             name---         pref:name        {http://uri-for-pref}name--functionName :: XParser String-functionName-    = try ( do           -            (p, n) <- qName-            uris   <- getState-            u      <- return $ if null p-	                       then ""-                               else '{' : show (lookupNs uris (newXName p)) ++ "}"-            let fn = (u ++ n) in-              if fn `elem` ["processing-instruction", "comment", "text", "node"]-                then fail ("function name: " ++ fn ++ "not allowed")-                else return fn-          )-      <?> "functionName"----- [36] VariableReference-variableReference :: XParser (String, String)-variableReference-    = do-      tokenParser (symbol "$")-      (p,n) <- qName-      uris   <- getState-      return (show (lookupNs uris (newXName p)), n)-      <?> "variableReference"----- [37] NameTest-nameTest :: AxisSpec -> XParser QName-nameTest as-    = do tokenParser (symbol "*")-	 uris <- getState-	 return (enhanceQN as uris $ mkPrefixLocalPart "" "*")-      <|>-      try ( do pre <- ncName-               _ <- symbol ":*"-               uris <- getState-               return (enhanceQN as uris $ mkPrefixLocalPart pre "*")-	  )-      <|>-      do (pre,local) <- qName-	 uris <- getState-	 return (enhanceQN as uris $ mkPrefixLocalPart pre local)-      <?> "nameTest"--	--- [38] NodeType-nodeType' :: XParser XPathNode-nodeType' -    = do-      nt <- nodeType-      lpar-      rpar-      return nt-      <?> "nodeType'"-	-nodeType :: XParser XPathNode-nodeType -    = choice [ symbolParser (n_comment, XPCommentNode)-             , symbolParser (n_text, XPTextNode)-             , symbolParser (n_processing_instruction, XPPINode)-             , symbolParser (n_node, XPNode)-             ]-      <?> "nodeType"---- ------------------------------------------------------------
− src/Text/XML/HXT/XPath/XPathToNodeSet.hs
@@ -1,78 +0,0 @@--- |--- Convert an XPath result set into a node set------module Text.XML.HXT.XPath.XPathToNodeSet-    ( xPValue2NodeSet-    , emptyNodeSet-    )-where--import Text.XML.HXT.DOM.TypeDefs-import Text.XML.HXT.XPath.XPathDataTypes--import Data.Maybe---- -------------------------------------------------------------------------------- |--- Convert a a XPath-value into a XmlNodeSet represented by a tree structure------ The XmlNodeSet can be used to traverse a tree an process all--- marked nodes.--xPValue2NodeSet		:: XPathValue -> XmlNodeSet-xPValue2NodeSet (XPVNode ns)-    = toNodeSet ns--xPValue2NodeSet _-    = emptyNodeSet--emptyNodeSet		:: XmlNodeSet-emptyNodeSet		= XNS False [] []--leafNodeSet		:: XmlNodeSet-leafNodeSet		= XNS True [] []--toNodeSet		:: NodeSet -> XmlNodeSet-toNodeSet-    = pathListToNodeSet . map toPath--toPath			:: NavXmlTree -> XmlNodeSet-toPath-    = upTree leafNodeSet---upTree			:: XmlNodeSet -> NavXmlTree -> XmlNodeSet-upTree ps t@(NT (NTree n _) _par left _right)-    = up (upNT t)-    where-    up (Just pt)-	| isJust . upNT $ pt		-- pt is a "real" node-	    = upTree (pix n) pt-	| otherwise			-- pt is the added root node, stop recursion-	    = ps-    up Nothing				-- never used recursion should stop earler-	= ps--    pix (XAttr qn)	= XNS False [qn] []-    pix _		= XNS False []   [(length left, ps)]--pathListToNodeSet	::[XmlNodeSet] -> XmlNodeSet-pathListToNodeSet-    = foldr mergePaths emptyNodeSet-    where-    mergePaths (XNS p1 al1 cl1) (XNS p2 al2 cl2)-	= XNS (p1 || p2) (al1 ++ al2) (mergeSubPaths cl1 cl2)--    mergeSubPaths []       sp2 = sp2-    mergeSubPaths (s1:sp1) sp2 = mergeSubPath s1 (mergeSubPaths sp1 sp2)--    mergeSubPath s1 []-	= [s1]-    mergeSubPath s1@(ix1,p1) sl@(s2@(ix2, p2) : sl')-	| ix1 < ix2	= s1 : sl-	| ix1 > ix2	= s2 : mergeSubPath s1 sl'		-- ordered insert of s1 -	| otherwise	= (ix1, mergePaths p1 p2) : sl'		-- same ix merge subpaths---- -----------------------------------------------------------------------------
− src/Text/XML/HXT/XPath/XPathToString.hs
@@ -1,136 +0,0 @@--- --------------------------------------------------------------{- |-   Module     : Text.XML.HXT.XPath.XPathToString-   Copyright  : Copyright (C) 2008 Uwe Schmidt-   License    : MIT--   Maintainer : Uwe Schmidt (uwe@fh-wedel.de)-   Stability  : experimental-   Portability: portable--   Format an expression or value in tree- or string-representation---}---- --------------------------------------------------------------module Text.XML.HXT.XPath.XPathToString-    ( expr2XPathTree-    , xPValue2String-    , xPValue2XmlTrees-    , nt2XPathTree-    , pred2XPathTree-    , toXPathTree-    )-where---- import Text.XML.HXT.DOM.XmlTree--import Text.XML.HXT.DOM.Interface-import Text.XML.HXT.DOM.XmlNode-    ( mkText-    , mkError-    )-import Text.XML.HXT.DOM.FormatXmlTree-    ( formatXmlTree )--import Text.XML.HXT.XPath.XPathDataTypes--import Data.Char-    ( toLower )---- --------------------------------------------------------------type XPathTree = NTree String----- -------------------------------------------------------------------------------- |--- Convert an navigable tree in a xmltree----toXPathTree			:: [NavTree a] -> [NTree a]-toXPathTree xs			= foldr (\ x -> (subtreeNT x :)) [] xs---- -------------------------------------------------------------------------------- |--- Format a XPath-value in string representation.--- Text output is done by 'formatXmlTree' for node-sets (trees),--- all other values are represented as strings.-----xPValue2String			:: XPathValue -> String-xPValue2String (XPVNode ns)-    = foldr (\t -> ((formatXmlTree t ++ "\n") ++)) "" (toXPathTree ns)-xPValue2String (XPVBool b) 	= map toLower (show b)-xPValue2String (XPVNumber (Float f)) = show f-xPValue2String (XPVNumber s) 	= show s-xPValue2String (XPVString s) 	= s-xPValue2String (XPVError s) 	= "Error: " ++ s---- -------------------------------------------------------------------------------- |--- Convert a a XPath-value into XmlTrees.-----xPValue2XmlTrees			:: XPathValue -> XmlTrees-xPValue2XmlTrees (XPVNode ns)		= toXPathTree ns-xPValue2XmlTrees (XPVBool b)		= xtext (show b)-xPValue2XmlTrees (XPVNumber (Float f))	= xtext (show f)-xPValue2XmlTrees (XPVNumber s)		= xtext (show s)-xPValue2XmlTrees (XPVString s)		= xtext s-xPValue2XmlTrees (XPVError  s)		= xerr s--xtext, xerr	:: String -> XmlTrees-xtext = (:[]) . mkText-xerr  = (:[]) . mkError c_err----- -------------------------------------------------------------------------------- |--- Format a parsed XPath-expression in tree representation.--- Text output is done by 'formatXmlTree'----expr2XPathTree			:: Expr -> XPathTree-expr2XPathTree (GenExpr op ex)	= NTree (show op) (map expr2XPathTree ex)-expr2XPathTree (NumberExpr f) 	= NTree (show f) []-expr2XPathTree (LiteralExpr s) 	= NTree s []-expr2XPathTree (VarExpr name) 	= NTree ("Var: " ++ show name) []-expr2XPathTree (FctExpr n arg)	= NTree ("Fct: " ++ n) (map expr2XPathTree arg)--expr2XPathTree (FilterExpr [])	= NTree "" []-expr2XPathTree (FilterExpr (primary:predicate))-    = NTree "FilterExpr" [expr2XPathTree primary, pred2XPathTree predicate]--expr2XPathTree (PathExpr Nothing (Just lp)) = locpath2XPathTree lp-expr2XPathTree (PathExpr (Just fe) (Just lp))-    = NTree "PathExpr" [expr2XPathTree fe, locpath2XPathTree lp]-expr2XPathTree (PathExpr _ _) 	= NTree "" []--locpath2XPathTree		:: LocationPath -> XPathTree-locpath2XPathTree (LocPath rel steps)-    = NTree (show rel ++ "LocationPath") (map step2XPathTree steps)---step2XPathTree 			:: XStep -> XPathTree-step2XPathTree (Step axis nt [])-    = NTree (show axis) [nt2XPathTree nt]-step2XPathTree (Step axis nt expr)-    = NTree (show axis) [nt2XPathTree nt, pred2XPathTree expr]--nt2XPathTree 			:: NodeTest -> XPathTree-nt2XPathTree (TypeTest s) 	= NTree ("TypeTest: "++ typeTest2String s) []-nt2XPathTree (PI s) 		= NTree ("TypeTest: processing-instruction("++ show s ++ ")") []-nt2XPathTree (NameTest s) 	= NTree ("NameTest: "++ show s) []---pred2XPathTree 			:: [Expr] -> XPathTree-pred2XPathTree exprL 		= NTree "Predicates" (map expr2XPathTree exprL)--typeTest2String 		:: XPathNode -> String-typeTest2String XPNode 		= "node()"-typeTest2String XPCommentNode	= "comment()"-typeTest2String XPPINode 	= "processing-instruction()"-typeTest2String XPTextNode 	= "text()"---- ------------------------------------------------------------