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

Safe HaskellSafe
LanguageHaskell98

Text.XML.Basic.Character

Description

All kinds of representations of a character in XML combined in one type. Note that an entity can in principle represent a large text, thus an "XML character" might actually be a text. However the standard entities consist of one character. In contrast to our representation, HaXml uses Unicode substrings instead of Unicode characters, which is certainly more efficient for common XML texts that contain mainly Unicode text and only few references. However our representation is unique, whereas HaXmls may represent a text as "abc","def" or "abcdef".

Synopsis

Documentation

data T Source #

Instances

Eq T Source # 

Methods

(==) :: T -> T -> Bool #

(/=) :: T -> T -> Bool #

Show T Source # 

Methods

showsPrec :: Int -> T -> ShowS #

show :: T -> String #

showList :: [T] -> ShowS #

C T Source # 

Methods

run :: T -> ShowS Source #

toUnicode :: T -> Exceptional String Char Source #

If a reference cannot be resolved then an Exception constructor with an error message is returned.

toUnicodeOrFormat :: T -> ShowS Source #

If a reference cannot be resolved then a reference string is returned.

refC :: Int -> T Source #

asciiFromUnicode :: Char -> T Source #

Convert unicode character to XML Char, where Unicode constructor is only used for ASCII characters. This is achieved by the following decision: If there is a entity reference, use this. If it is ASCII, represent it as Char. Otherwise use a character reference.

minimalRefFromUnicode :: Char -> T Source #

Generate XML character from Unicode character with minimal use of references. The only references used are the XML entity references ', ", &, <, >.

reduceRef :: T -> T Source #

Reduce the use of references. Represent as much as possible characters as Unicode characters, that is, using the Unicode constructor.

reduceRefGen :: Map String Char -> T -> T Source #

try to convert a References to equivalent Unicode characters

switchUnicodeRuns :: (String -> a) -> (Int -> a) -> (String -> a) -> [T] -> [a] Source #