-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Streaming XML parser based on conduits.
--
-- This library provides an alternative, hopefully higher-level
-- implementation for the parsing part of xml-conduit.
@package xml-conduit-parse
@version 0.1.0.0
-- | Low-level primitives.
module Data.Conduit.Parser.XML.Internal
type AttributeMap = Map Name [Content]
-- | Parse an EventBeginDocument.
beginDocument :: (MonadCatch m) => ConduitParser Event m ()
-- | Parse an EventEndDocument.
endDocument :: (MonadCatch m) => ConduitParser Event m ()
-- | Parse an EventBeginDoctype.
beginDoctype :: (MonadCatch m) => ConduitParser Event m (Text, Maybe ExternalID)
-- | Parse an EventEndDoctype.
endDoctype :: (MonadCatch m) => ConduitParser Event m ()
-- | Parse an EventInstruction.
instruction :: (MonadCatch m) => ConduitParser Event m Instruction
-- | Parse an EventBeginElement.
beginElement :: (MonadCatch m) => ConduitParser Event m (Name, AttributeMap)
-- | Parse an EventEndElement.
endElement :: (MonadCatch m) => ConduitParser Event m Name
-- | Parse a ContentEntity (within an EventContent).
contentEntity :: (MonadCatch m) => ConduitParser Event m Text
-- | Parse a ContentText (within an EventContent).
contentText :: (MonadCatch m) => ConduitParser Event m Text
-- | Parse an EventComment.
comment :: (MonadCatch m) => ConduitParser Event m Text
-- | Parse an EventCDATA.
cdata :: (MonadCatch m) => ConduitParser Event m Text
-- | Parse a textual EventContent or an EventCDATA.
text :: (MonadCatch m) => ConduitParser Event m Text
-- | High-level primitives to parse a stream of XML Events.
module Data.Conduit.Parser.XML
-- | Parse an XML tag. This is the most generic tag parser.
--
-- Comments, instructions and whitespace are ignored.
tag :: (MonadCatch m) => (Name -> Maybe a) -> (a -> AttrParser b) -> (b -> ConduitParser Event m c) -> ConduitParser Event m c
-- | Like tag, but match a single tag name.
tagName :: (MonadCatch m) => Name -> AttrParser a -> (a -> ConduitParser Event m b) -> ConduitParser Event m b
-- | Like tag, but use a predicate to select tag names.
tagPredicate :: (MonadCatch m) => (Name -> Bool) -> AttrParser a -> (a -> ConduitParser Event m b) -> ConduitParser Event m b
-- | Like tagName, but expect no attributes at all.
tagNoAttr :: MonadCatch m => Name -> ConduitParser Event m a -> ConduitParser Event m a
type AttributeMap = Map Name [Content]
data AttrParser a
-- | Single attribute parser.
attr :: Name -> AttrParser Text
-- | Consume all remaining unparsed attributes.
ignoreAttrs :: AttrParser ()
-- | Parse a tag content.
content :: MonadCatch m => ConduitParser Event m Text
-- | Parses a byte stream into Events. This function is implemented
-- fully in Haskell using attoparsec-text for parsing. The produced error
-- messages do not give line/column information, so you may prefer to
-- stick with the parser provided by libxml-enumerator. However, this has
-- the advantage of not relying on any C libraries.
--
-- This relies on detectUtf to determine character encoding, and
-- parseText' to do the actual parsing.
parseBytes :: MonadThrow m => ParseSettings -> Conduit ByteString m Event
parseBytesPos :: MonadThrow m => ParseSettings -> Conduit ByteString m EventPos
-- | Alias for parseText'
parseText :: (MonadThrow m) => ParseSettings -> Conduit Text m Event
-- | Same as parseText', but includes the position of each event.
--
-- Since 1.2.4
parseTextPos :: MonadThrow m => ParseSettings -> Conduit Text m EventPos
-- | Automatically determine which UTF variant is being used. This function
-- first checks for BOMs, removing them as necessary, and then check for
-- the equivalent of <?xml for each of UTF-8, UTF-16LEBE, and
-- UTF-32LEBE. It defaults to assuming UTF-8.
detectUtf :: MonadThrow m => Conduit ByteString m Text
-- | A helper function which reads a file from disk using
-- enumFile, detects character encoding using detectUtf,
-- parses the XML using parseBytes, and then hands off control to
-- your supplied parser.
parseFile :: MonadResource m => ParseSettings -> FilePath -> Producer m Event
-- | Parse an event stream from a lazy ByteString.
parseLBS :: MonadThrow m => ParseSettings -> ByteString -> Producer m Event
data ParseSettings :: *
type DecodeEntities = Text -> Content
psDecodeEntities :: ParseSettings -> DecodeEntities
-- | Whether the original xmlns attributes should be retained in the parsed
-- values. For more information on motivation, see:
--
-- https://github.com/snoyberg/xml/issues/38
--
-- Default: False
--
-- Since 1.2.1
psRetainNamespaces :: ParseSettings -> Bool
-- | Default implementation of DecodeEntities: handles numeric
-- entities and the five standard character entities (lt, gt, amp, quot,
-- apos).
decodeXmlEntities :: DecodeEntities
-- | HTML4-compliant entity decoder. Handles numerics, the five standard
-- character entities, and the additional 248 entities defined by HTML 4
-- and XHTML 1.
--
-- Note that HTML 5 introduces a drastically larger number of entities,
-- and this code does not recognize most of them.
decodeHtmlEntities :: DecodeEntities
data XmlException :: *
XmlException :: String -> Maybe Event -> XmlException
[xmlErrorMessage] :: XmlException -> String
[xmlBadInput] :: XmlException -> Maybe Event
InvalidEndElement :: Name -> XmlException
InvalidEntity :: Text -> XmlException
UnparsedAttributes :: [(Name, [Content])] -> XmlException
instance GHC.Base.Monad Data.Conduit.Parser.XML.AttrParser
instance GHC.Base.Functor Data.Conduit.Parser.XML.AttrParser
instance GHC.Base.Applicative Data.Conduit.Parser.XML.AttrParser
instance GHC.Base.Alternative Data.Conduit.Parser.XML.AttrParser
instance Control.Monad.Catch.MonadThrow Data.Conduit.Parser.XML.AttrParser