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



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.



data T Source


Eq T 
Show T 
C T 

toUnicode :: T -> Exceptional String CharSource

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

toUnicodeOrFormat :: T -> ShowSSource

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

asciiFromUnicode :: Char -> TSource

Convert unicode character to XML Char. If there is a entity reference, use this. If it is ASCII, represent it as Char. Otherwise use a character reference.

reduceRefGen :: Map String Char -> T -> TSource

try to convert a References to equivalent Unicode characters

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