-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Bindings for the libXML2 SAX interface
--   
--   Bindings for the libXML2 SAX interface
@package libxml-sax
@version 0.7.5


-- | Bindings for the libXML2 SAX interface
module Text.XML.LibXML.SAX

-- | A <a>Parser</a> tracks the internal state of a LibXML parser context.
--   
--   As LibXML is a very stateful library, parsers must operate within
--   either the <a>IO</a> or <a>ST</a> monad. Use <a>newParserIO</a> or
--   <a>newParserST</a> to create parsers in the appropriate monad.
--   
--   In general, clients should prefer <a>newParserST</a>, because ST
--   values can be safely computed with no side effects.
data Parser m
newParserIO :: Maybe Text -> IO (Parser IO)
newParserST :: Maybe Text -> ST s (Parser (ST s))
parseBytes :: Parser m -> ByteString -> m ()

-- | Finish parsing any buffered data, and check that the document was
--   closed correctly.
parseComplete :: Parser m -> m ()
data Callback m a

-- | Set a callback computation to run when a particular parse event
--   occurs. The callback should return <a>True</a> to continue parsing, or
--   <a>False</a> to abort.
--   
--   Alternatively, callbacks may throw an <a>Exception</a> to abort
--   parsing. The exception will be propagated through to the caller of
--   <a>parseBytes</a> or <a>parseComplete</a>.
setCallback :: Parser m -> Callback m a -> a -> m ()

-- | Remove a callback from the parser. This might also change the parser's
--   behavior, such as automatically expanding entity references when no
--   <a>parsedReference</a> callback is set.
clearCallback :: Parser m -> Callback m a -> m ()
parsedBeginDocument :: Callback m (m Bool)
parsedEndDocument :: Callback m (m Bool)
parsedBeginElement :: Callback m (Name -> [(Name, [Content])] -> m Bool)
parsedEndElement :: Callback m (Name -> m Bool)
parsedCharacters :: Callback m (Text -> m Bool)

-- | If <a>parsedReference</a> is set, entity references in element and
--   attribute content will reported separately from text, and will not be
--   automatically expanded.
--   
--   Use this when processing documents in passthrough mode, to preserve
--   existing entity references.
parsedReference :: Callback m (Text -> m Bool)
parsedComment :: Callback m (Text -> m Bool)
parsedInstruction :: Callback m (Instruction -> m Bool)

-- | If <a>parsedCDATA</a> is set, it receives any text contained in CDATA
--   blocks. By default, all text is received by <a>parsedCharacters</a>.
parsedCDATA :: Callback m (Text -> m Bool)

-- | If <a>parsedWhitespace</a> is set, it receives any whitespace marked
--   as ignorable by the document's DTD. By default, all text is received
--   by <a>parsedCharacters</a>.
parsedWhitespace :: Callback m (Text -> m Bool)
parsedInternalSubset :: Callback m (Text -> Maybe ExternalID -> m Bool)
parsedExternalSubset :: Callback m (Text -> Maybe ExternalID -> m Bool)
reportWarning :: Callback m (Text -> m Bool)
reportError :: Callback m (Text -> m Bool)
