Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
SAX parser and API for XML.
Synopsis
- process :: (Monad m, StringLike str) => Process (m ()) -> str -> m ()
- data Process a = Process {
- openF :: !(ByteString -> a)
- attrF :: !(ByteString -> ByteString -> a)
- endOpenF :: !(ByteString -> a)
- textF :: !(ByteString -> a)
- closeF :: !(ByteString -> a)
- cdataF :: !(ByteString -> a)
- class StringLike str where
- s_index' :: str -> Int -> Word8
- elemIndexFrom' :: Word8 -> str -> Int -> Maybe Int
- drop' :: Int -> str -> str
- substring' :: str -> Int -> Int -> ByteString
- toBS :: str -> ByteString
- fold :: (s -> ByteString -> s) -> (s -> ByteString -> ByteString -> s) -> (s -> ByteString -> s) -> (s -> ByteString -> s) -> (s -> ByteString -> s) -> (s -> ByteString -> s) -> s -> ByteString -> Either XenoException s
- validate :: StringLike str => str -> Bool
- validateEx :: StringLike str => str -> Bool
- dump :: ByteString -> IO ()
- skipDoctype :: ByteString -> ByteString
Documentation
process :: (Monad m, StringLike str) => Process (m ()) -> str -> m () Source #
Process events with callbacks in the XML input.
Parameters to the process
function
Process | |
|
class StringLike str where Source #
s_index' :: str -> Int -> Word8 Source #
elemIndexFrom' :: Word8 -> str -> Int -> Maybe Int Source #
drop' :: Int -> str -> str Source #
substring' :: str -> Int -> Int -> ByteString Source #
toBS :: str -> ByteString Source #
Instances
StringLike ByteString Source # | |
Defined in Xeno.SAX s_index' :: ByteString -> Int -> Word8 Source # elemIndexFrom' :: Word8 -> ByteString -> Int -> Maybe Int Source # drop' :: Int -> ByteString -> ByteString Source # substring' :: ByteString -> Int -> Int -> ByteString Source # toBS :: ByteString -> ByteString Source # | |
StringLike ByteStringZeroTerminated Source # | |
Defined in Xeno.SAX s_index' :: ByteStringZeroTerminated -> Int -> Word8 Source # elemIndexFrom' :: Word8 -> ByteStringZeroTerminated -> Int -> Maybe Int Source # drop' :: Int -> ByteStringZeroTerminated -> ByteStringZeroTerminated Source # substring' :: ByteStringZeroTerminated -> Int -> Int -> ByteString Source # |
:: (s -> ByteString -> s) | Open tag. |
-> (s -> ByteString -> ByteString -> s) | Attribute key/value. |
-> (s -> ByteString -> s) | End of open tag. |
-> (s -> ByteString -> s) | Text. |
-> (s -> ByteString -> s) | Close tag. |
-> (s -> ByteString -> s) | CDATA. |
-> s | |
-> ByteString | |
-> Either XenoException s |
Fold over the XML input.
validate :: StringLike str => str -> Bool Source #
Parse the XML but return no result, process no events.
N.B.: Only the lexical correctness of the input string is checked, not its XML semantics (e.g. only if tags are well formed, not whether tags are properly closed)
> :set -XOverloadedStrings > validate "<b>" True
> validate "<b" False
validateEx :: StringLike str => str -> Bool Source #
Parse the XML and checks tags nesting.
dump :: ByteString -> IO () Source #
Parse the XML and pretty print it to stdout.
skipDoctype :: ByteString -> ByteString Source #
Skip initial DOCTYPE declaration