scc-0.3: Streaming component combinators

Control.Concurrent.SCC.XMLComponents

Contents

Description

Module XMLComponents defines primitive components for parsing and manipulating XML.

Synopsis

Types

Parsing XML

tokens :: ParallelizableMonad m => Splitter m Char (Boundary Token)Source

The tokens splitter distinguishes XML markup from data content. It is used by parseTokens.

parseTokens :: ParallelizableMonad m => Parser m Char TokenSource

The XML token parser. This parser converts plain text to parsed text, which is a precondition for using the remaining XML components.

expandEntity :: String -> StringSource

Converts an XML entity name into the text value it represents: expandEntity "lt" = "<".

Showing XML

escapeAttributeCharacter :: Char -> StringSource

Escapes a character for inclusion into an XML attribute value.

escapeContentCharacter :: Char -> StringSource

Escapes a character for inclusion into the XML data content.

Splitters

element :: Monad m => Splitter m (Markup Char Token) ()Source

Splits all top-level elements with all their content to true, all other input to false.

elementContent :: Monad m => Splitter m (Markup Char Token) ()Source

Splits the content of all top-level elements to true, their tags and intervening input to false.

elementName :: ParallelizableMonad m => Splitter m (Markup Char Token) ()Source

Splits every element name, including the names of nested elements and names in end tags, to true, all the rest of input to false.

attribute :: ParallelizableMonad m => Splitter m (Markup Char Token) ()Source

Splits every attribute specification to true, everything else to false.

attributeName :: ParallelizableMonad m => Splitter m (Markup Char Token) ()Source

Splits every attribute name to true, all the rest of input to false.

attributeValue :: ParallelizableMonad m => Splitter m (Markup Char Token) ()Source

Splits every attribute value, excluding the quote delimiters, to true, all the rest of input to false.

Splitter combinators

elementHavingTag :: (ParallelizableMonad m, Typeable b) => Splitter m (Markup Char Token) b -> Splitter m (Markup Char Token) bSource

Similiar to (having element), except it runs the argument splitter only on each element's start tag, not on the entire element with its content.

havingText :: (ParallelizableMonad m, Typeable b1, Typeable b2) => Splitter m (Markup Char Token) b1 -> Splitter m Char b2 -> Splitter m (Markup Char Token) b1Source

Behaves like having, but the right-hand splitter works on plain instead of marked-up text. This allows regular Char splitters to be applied to parsed XML.

havingOnlyText :: (ParallelizableMonad m, Typeable b1, Typeable b2) => Splitter m (Markup Char Token) b1 -> Splitter m Char b2 -> Splitter m (Markup Char Token) b1Source

Behaves like havingOnly, but the right-hand splitter works on plain instead of marked-up text. This allows regular Char splitters to be applied to parsed XML.