xmlhtml-0.1.7: XML parser and renderer with HTML 5 quirks mode

Safe HaskellSafe-Infered

Text.XmlHtml.TextParser

Synopsis

Documentation

guessEncoding :: ByteString -> (Encoding, ByteString)Source

Get an initial guess at document encoding from the byte order mark. If the mark doesn't exist, guess UTF-8. Otherwise, guess according to the mark.

isValidChar :: Char -> BoolSource

Checks if a document contains invalid characters.

parseTextSource

Arguments

:: Parser a

The parser to match

-> String

Name of the source file (can be "")

-> Text

Text to parse

-> Either String a 

Parses a Text value and gives back the result. The parser is expected to match the entire string.

takeWhile0 :: (Char -> Bool) -> Parser TextSource

Consume input as long as the predicate returns True, and return the consumed input. This parser does not fail. If it matches no input, it will return an empty string.

takeWhile1 :: (Char -> Bool) -> Parser TextSource

Consume input as long as the predicate returns True, and return the consumed input. This parser requires the predicate to succeed on at least one character of input. It will fail if the first character fails the predicate.

text :: Text -> Parser TextSource

The equivalent of Parsec's string combinator, but for text. If there is not a complete match, then no input is consumed. This matches the behavior of string from the attoparsec-text package.

scanText :: (Char -> ScanState) -> Parser StringSource

Scans text and progresses through a DFA, collecting the complete matching text as it goes.

data ScanState Source

Represents the state of a text scanner, for use with the scanText parser combinator.