xeno-0.6: A fast event-based XML parser in pure Haskell
Safe HaskellSafe-Inferred
LanguageHaskell2010

Xeno.SAX

Description

SAX parser and API for XML.

Synopsis

Documentation

process :: (Monad m, StringLike str) => Process (m ()) -> str -> m () Source #

Process events with callbacks in the XML input.

data Process a Source #

Parameters to the process function

Constructors

Process 

Fields

fold Source #

Arguments

:: (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