-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | XML parser with informative error-reporting and simple API -- -- XML parser with informative error-reporting and simple API @package xml-parser @version 0.1.1 module XmlParser -- | Parse XML bytestring. parseByteString :: Element a -> ByteString -> Either Text a -- | Parse XML lazy bytestring. parseLazyByteString :: Element a -> ByteString -> Either Text a -- | Parse XML file. parseFile :: Element a -> FilePath -> IO (Either Text a) -- | Parse an "xml-conduit" element AST. parseElementAst :: Element a -> Element -> Either Text a -- | Parse in the context of an element node. data Element a -- | Parse namespace and name with the given function. elementName :: (Maybe Text -> Text -> Either Text a) -> Element a -- | Fail if the namespace and name don't match the provided. elementNameIs :: Maybe Text -> Text -> Element () -- | Children sequence by order. children :: Nodes a -> Element a -- | Look up elements by name and parse them. childrenByName :: ByName Element a -> Element a -- | Look up the last attribute by name and parse it. attributesByName :: ByName Content a -> Element a -- | Expose the element's AST. astElement :: Element Element -- | Parser in the context of a sequence of nodes. data Nodes a -- | Consume the next node expecting it to be element and parse its -- contents. elementNode :: Element a -> Nodes a -- | Consume the next node expecting it to be textual and parse its -- contents. contentNode :: Content content -> Nodes content -- | Composable extension to a parser, which looks up its input by name. -- -- Useful for searching elements and attributes by name. -- -- Alternative and MonadPlus alternate only on lookup errors. When lookup -- is successful, but the deeper parser fails, the error propagates. -- -- Monad and Applicative sequentially fetch contents by matching names. data ByName parser a -- | Execute a parser on the result of looking up a content by namespace -- and name. byName :: Maybe Text -> Text -> parser a -> ByName parser a -- | Parser in the context of decoded textual content, which can be the -- value of an attribute or a textual node. data Content content -- | Return the content as it is. textContent :: Content Text -- | Map the content to a type if it's valid. narrowedContent :: (Text -> Maybe a) -> Content a -- | Parse the content with a possibly failing function. refinedContent :: (Text -> Either Text a) -> Content a -- | Map the content using a dictionary. enumContent :: [(Text, a)] -> Content a -- | Parse the content using the "attoparsec" parser. attoparsedContent :: Parser a -> Content a -- | Parse the content as XML Schema QName, automatically resolving the -- namespace as URI and failing, if none is associated. -- -- Produces a URI associated with the namespace and name. If the content -- does not contain colon, produces an unnamespaced name. -- -- Refs: -- -- qNameContent :: Content (Maybe Text, Text)