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

Safe HaskellSafe-Inferred

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) 

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

toCursorSource

Arguments

:: (node -> [node])

get children

-> node 
-> Cursor node 

node :: Cursor node -> nodeSource

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 nodeSource

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 nodeSource

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

followingSibling :: Axis nodeSource

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

ancestor :: Axis nodeSource

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 nodeSource

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 nodeSource

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

preceding :: Axis nodeSource

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 nodeSource

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

Apply a function to the result of an axis.

(&/) :: Axis node -> (Cursor node -> [a]) -> Cursor node -> [a]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]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]Source

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

($|) :: Cursor node -> (Cursor node -> a) -> aSource

Apply an axis to a 'Cursor node'.

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

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

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

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

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

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

(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c

Left-to-right Kleisli composition of monads.