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

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

Text.XML.HXT.XPath.XPathEval

Description

The core functions for evaluating the different types of XPath expressions. Each `Expr`-constructor is mapped to an evaluation function.

Synopsis

- getXPath :: String -> XmlTree -> XmlTrees
- getXPathSubTrees :: String -> XmlTree -> XmlTrees
- getXPathNodeSet' :: String -> XmlTree -> XmlNodeSet
- getXPathWithNsEnv :: Attributes -> String -> XmlTree -> XmlTrees
- getXPathSubTreesWithNsEnv :: Attributes -> String -> XmlTree -> XmlTrees
- getXPathNodeSetWithNsEnv' :: Attributes -> String -> XmlTree -> XmlNodeSet
- evalExpr :: Env -> Context -> Expr -> XPathFilter
- addRoot' :: XmlTree -> XmlTree
- parseXPathExpr :: String -> Either String Expr
- parseXPathExprWithNsEnv :: Attributes -> String -> Either String Expr
- getXPath' :: Expr -> XmlTree -> XmlTrees
- getXPathSubTrees' :: Expr -> XmlTree -> XmlTrees
- getXPathNodeSet'' :: Expr -> XmlTree -> XmlNodeSet

# Documentation

getXPath :: String -> XmlTree -> XmlTrees Source #

Select parts of a document by a string representing 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. Result is a possibly empty list of XmlTrees forming the set of selected XPath values. XPath values other than XmlTrees (numbers, attributes, tagnames, ...) are converted to text nodes.

getXPathSubTrees :: String -> XmlTree -> XmlTrees Source #

Select parts of an XML tree by a string representing an 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.

getXPathNodeSet' :: String -> XmlTree -> XmlNodeSet Source #

compute the node set of an XPath query

getXPathWithNsEnv :: Attributes -> String -> XmlTree -> XmlTrees Source #

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

getXPathSubTreesWithNsEnv :: Attributes -> String -> XmlTree -> XmlTrees Source #

Same as `getXPathSubTrees` but with namespace aware XPath expression

getXPathNodeSetWithNsEnv' :: Attributes -> String -> XmlTree -> XmlNodeSet Source #

compute the node set of a namespace aware XPath query

evalExpr :: Env -> Context -> Expr -> XPathFilter Source #

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.

addRoot' :: XmlTree -> XmlTree Source #

parseXPathExpr :: String -> Either String Expr Source #

parse an XPath expr string and return an expr tree or an error message. Namespaces are not taken into account.

parseXPathExprWithNsEnv :: Attributes -> String -> Either String Expr Source #

parse an XPath expr string with a namespace environment for qualified names in the XPath expr and return an expr tree or an error message

getXPath' :: Expr -> XmlTree -> XmlTrees Source #

Select parts of a document by an already parsed XPath expression

getXPathSubTrees' :: Expr -> XmlTree -> XmlTrees Source #

Select parts of an XML tree by an XPath expression.

getXPathNodeSet'' :: Expr -> XmlTree -> XmlNodeSet Source #

compute the node set of an XPath query for an already parsed XPath expr