scc-0.5.1: Streaming component combinators

Control.Concurrent.SCC.XML

Contents

Description

Module XML defines primitives and combinators for parsing and manipulating XML.

Synopsis

Types

Parsing XML

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

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

parseTokens :: Monad 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 Token Char) ()Source

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

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

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

elementName :: Monad m => Splitter m (Markup Token Char) ()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 :: Monad m => Splitter m (Markup Token Char) ()Source

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

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

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

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

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

SplitterComponent combinators

elementHavingTag :: forall m b. MonadParallel m => Splitter m (Markup Token Char) b -> Splitter m (Markup Token Char) bSource

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

havingText :: forall m b1 b2. MonadParallel m => Bool -> Splitter m (Markup Token Char) b1 -> Splitter m Char b2 -> Splitter m (Markup Token Char) b1Source

Behaves like Control.Concurrent.SCC.Combinators.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 :: forall m b1 b2. MonadParallel m => Bool -> Splitter m (Markup Token Char) b1 -> Splitter m Char b2 -> Splitter m (Markup Token Char) b1Source

Behaves like Control.Concurrent.SCC.Combinators.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.