xml-conduit-1.5.1: Pure-Haskell utilities for dealing with XML with the conduit package.

Safe HaskellSafe
LanguageHaskell98

Text.XML.Cursor.Generic

Contents

Description

Generalized cursors to be applied to different nodes.

Synopsis

Core

data Cursor node Source #

A cursor: contains an XML Node and pointers to its children, ancestors and siblings.

Instances

Show node => Show (Cursor node) Source # 

Methods

showsPrec :: Int -> Cursor node -> ShowS #

show :: Cursor node -> String #

showList :: [Cursor node] -> ShowS #

type Axis node = Cursor node -> [Cursor node] Source #

toCursor Source #

Arguments

:: (node -> [node])

get children

-> node 
-> Cursor node 

node :: Cursor node -> node Source #

The current node.

Axes

child :: Cursor node -> [Cursor node] Source #

The child axis. XPath: the child axis contains the children of the context node.

parent :: Axis node Source #

The parent axis. As described in XPath: the parent axis contains the parent of the context node, if there is one.

Every node but the root element of the document has a parent. Parent nodes will always be NodeElements.

precedingSibling :: Axis node Source #

The preceding-sibling axis. XPath: the preceding-sibling axis contains all the preceding siblings of the context node [...].

followingSibling :: Axis node Source #

The following-sibling axis. XPath: the following-sibling axis contains all the following siblings of the context node [...].

ancestor :: Axis node Source #

The ancestor axis. XPath: the ancestor axis contains the ancestors of the context node; the ancestors of the context node consist of the parent of context node and the parent's parent and so on; thus, the ancestor axis will always include the root node, unless the context node is the root node.

descendant :: Axis node Source #

The descendant axis. XPath: the descendant axis contains the descendants of the context node; a descendant is a child or a child of a child and so on; thus the descendant axis never contains attribute or namespace nodes.

orSelf :: Axis node -> Axis node Source #

Modify an axis by adding the context node itself as the first element of the result list.

preceding :: Axis node Source #

The preceding axis. XPath: the preceding axis contains all nodes in the same document as the context node that are before the context node in document order, excluding any ancestors and excluding attribute nodes and namespace nodes.

following :: Axis node Source #

The following axis. XPath: the following axis contains all nodes in the same document as the context node that are after the context node in document order, excluding any descendants and excluding attribute nodes and namespace nodes.

Operators

(&|) :: (Cursor node -> [a]) -> (a -> b) -> Cursor node -> [b] infixr 1 Source #

Apply a function to the result of an axis.

(&/) :: Axis node -> (Cursor node -> [a]) -> Cursor node -> [a] infixr 1 Source #

Combine two axes so that the second works on the children of the results of the first.

(&//) :: Axis node -> (Cursor node -> [a]) -> Cursor node -> [a] infixr 1 Source #

Combine two axes so that the second works on the descendants of the results of the first.

(&.//) :: Axis node -> (Cursor node -> [a]) -> Cursor node -> [a] infixr 1 Source #

Combine two axes so that the second works on both the result nodes, and their descendants.

($|) :: Cursor node -> (Cursor node -> a) -> a infixr 1 Source #

Apply an axis to a 'Cursor node'.

($/) :: Cursor node -> (Cursor node -> [a]) -> [a] infixr 1 Source #

Apply an axis to the children of a 'Cursor node'.

($//) :: Cursor node -> (Cursor node -> [a]) -> [a] infixr 1 Source #

Apply an axis to the descendants of a 'Cursor node'.

($.//) :: Cursor node -> (Cursor node -> [a]) -> [a] infixr 1 Source #

Apply an axis to a 'Cursor node' as well as its descendants.

(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c infixr 1 #

Left-to-right Kleisli composition of monads.