xml-basic-0.1.2: Basics for XML/HTML representation and processing

Safe HaskellSafe
LanguageHaskell98

Text.HTML.Basic.Entity

Synopsis

Documentation

list :: [(Name, Char)] Source #

A table mapping HTML entity names to code points. Although entity references can in principle represent more than one character, the standard entities only contain one character.

numberToChar :: String -> Exceptional String Char Source #

Lookup a numeric entity, the leading '#' must have already been removed.

numberToChar "65" == Success 'A'
numberToChar "x41" == Success 'A'
numberToChar "x4E" === Success 'N'
numberToChar "x4e" === Success 'N'
numberToChar "Haskell" == Exception "..."
numberToChar "" == Exception "..."
numberToChar "89439085908539082" == Exception "..."

It's safe to use that for arbitrary big number strings, since we abort parsing as soon as possible.

numberToChar (repeat '1') == Exception "..."