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


-- | A fast event-based XML parser in pure Haskell
--   
--   A fast, low-memory use, event-based XML parser in pure Haskell.
@package xeno
@version 0.6


-- | Efficient DOM data structure
module Xeno.DOM.Internal

-- | Some XML nodes.
data Node
Node :: !ByteString -> !Int -> !Vector Int -> Node

-- | Content of a node.
data Content
Element :: {-# UNPACK #-} !Node -> Content
Text :: {-# UNPACK #-} !ByteString -> Content
CData :: {-# UNPACK #-} !ByteString -> Content

-- | Name of the element.
name :: Node -> ByteString

-- | Attributes of a node.
attributes :: Node -> [(ByteString, ByteString)]

-- | Contents of a node.
contents :: Node -> [Content]

-- | Get just element children of the node (no text).
children :: Node -> [Node]
instance Data.Data.Data Xeno.DOM.Internal.Node
instance GHC.Classes.Eq Xeno.DOM.Internal.Node
instance Data.Data.Data Xeno.DOM.Internal.Content
instance GHC.Show.Show Xeno.DOM.Internal.Content
instance GHC.Classes.Eq Xeno.DOM.Internal.Content
instance Control.DeepSeq.NFData Xeno.DOM.Internal.Content
instance Control.DeepSeq.NFData Xeno.DOM.Internal.Node
instance GHC.Show.Show Xeno.DOM.Internal.Node


-- | Shared types.
module Xeno.Types
data XenoException
XenoStringIndexProblem :: Int -> ByteString -> XenoException
[stringIndex] :: XenoException -> Int
[inputString] :: XenoException -> ByteString
XenoParseError :: Int -> ByteString -> XenoException
[inputIndex] :: XenoException -> Int
[message] :: XenoException -> ByteString
XenoExpectRootNode :: XenoException

-- | ByteString wich guaranted have 'NUL' at the end
newtype ByteStringZeroTerminated
BSZT :: ByteString -> ByteStringZeroTerminated
instance GHC.Generics.Generic Xeno.Types.XenoException
instance Control.DeepSeq.NFData Xeno.Types.XenoException
instance Data.Data.Data Xeno.Types.XenoException
instance GHC.Show.Show Xeno.Types.XenoException
instance Control.DeepSeq.NFData Xeno.Types.ByteStringZeroTerminated
instance GHC.Generics.Generic Xeno.Types.ByteStringZeroTerminated
instance Control.Monad.Fail.MonadFail (Data.Either.Either Xeno.Types.XenoException)
instance GHC.Exception.Type.Exception Xeno.Types.XenoException


-- | SAX parser and API for XML.
module Xeno.SAX

-- | Process events with callbacks in the XML input.
process :: (Monad m, StringLike str) => Process (m ()) -> str -> m ()

-- | Parameters to the <a>process</a> function
data Process a
Process :: !ByteString -> a -> !ByteString -> ByteString -> a -> !ByteString -> a -> !ByteString -> a -> !ByteString -> a -> !ByteString -> a -> Process a

-- | Open tag.
[openF] :: Process a -> !ByteString -> a

-- | Tag attribute.
[attrF] :: Process a -> !ByteString -> ByteString -> a

-- | End open tag.
[endOpenF] :: Process a -> !ByteString -> a

-- | Text.
[textF] :: Process a -> !ByteString -> a

-- | Close tag.
[closeF] :: Process a -> !ByteString -> a

-- | CDATA.
[cdataF] :: Process a -> !ByteString -> a
class StringLike str
s_index' :: StringLike str => str -> Int -> Word8
elemIndexFrom' :: StringLike str => Word8 -> str -> Int -> Maybe Int
drop' :: StringLike str => Int -> str -> str
substring' :: StringLike str => str -> Int -> Int -> ByteString
toBS :: StringLike str => str -> ByteString

-- | Fold over the XML input.
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

-- | 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)
--   
--   <pre>
--   &gt; :set -XOverloadedStrings
--   &gt; validate "&lt;b&gt;"
--   True
--   </pre>
--   
--   <pre>
--   &gt; validate "&lt;b"
--   False
--   </pre>
validate :: StringLike str => str -> Bool

-- | Parse the XML and checks tags nesting.
validateEx :: StringLike str => str -> Bool

-- | Parse the XML and pretty print it to stdout.
dump :: ByteString -> IO ()

-- | Skip initial DOCTYPE declaration
skipDoctype :: ByteString -> ByteString
instance Xeno.SAX.StringLike Data.ByteString.Internal.Type.ByteString
instance Xeno.SAX.StringLike Xeno.Types.ByteStringZeroTerminated


-- | Simplifies raising and presenting localized exceptions to the user.
module Xeno.Errors

-- | Print schema errors with excerpts
printExceptions :: ByteString -> [XenoException] -> IO ()
displayException :: ByteString -> XenoException -> ByteString
getStartIndex :: ByteString -> Int
failHere :: ByteString -> ByteString -> Either XenoException a


-- | DOM parser and API for XML. Slightly slower DOM parsing, but add
--   missing close tags.
module Xeno.DOM.Robust

-- | Parse a complete Nodes document.
parse :: ByteString -> Either XenoException Node

-- | Some XML nodes.
data Node

-- | Content of a node.
data Content
Element :: {-# UNPACK #-} !Node -> Content
Text :: {-# UNPACK #-} !ByteString -> Content
CData :: {-# UNPACK #-} !ByteString -> Content

-- | Name of the element.
name :: Node -> ByteString

-- | Attributes of a node.
attributes :: Node -> [(ByteString, ByteString)]

-- | Contents of a node.
contents :: Node -> [Content]

-- | Get just element children of the node (no text).
children :: Node -> [Node]


-- | DOM parser and API for XML.
module Xeno.DOM

-- | Parse a complete Nodes document.
parse :: ByteString -> Either XenoException Node

-- | Some XML nodes.
data Node

-- | Content of a node.
data Content
Element :: {-# UNPACK #-} !Node -> Content
Text :: {-# UNPACK #-} !ByteString -> Content
CData :: {-# UNPACK #-} !ByteString -> Content

-- | Name of the element.
name :: Node -> ByteString

-- | Attributes of a node.
attributes :: Node -> [(ByteString, ByteString)]

-- | Contents of a node.
contents :: Node -> [Content]

-- | Get just element children of the node (no text).
children :: Node -> [Node]
