xml-conduit-parse 0.3.0.0 → 0.3.1.0
raw patch · 2 files changed
+9/−4 lines, 2 files
Files
Data/Conduit/Parser/XML.hs view
@@ -7,6 +7,7 @@ , tagName , tagPredicate , tagNoAttr+ , tagIgnoreAttrs , anyTag -- ** Attributes , AttributeMap@@ -61,7 +62,7 @@ -- This is the most generic tag parser. -- -- Comments, instructions and whitespace are ignored.-tag :: (MonadCatch m)+tag :: MonadCatch m => (Name -> Maybe a) -- ^ Tag name parser. -> (a -> AttrParser b) -- ^ Attributes parser. It should consume all available attributes. -> (b -> ConduitParser Event m c) -- ^ Children parser. It should consume all elements between the opening and closing tags.@@ -88,16 +89,20 @@ Right (a, x) -> if null a then Right x else Left . toException $ Reexport.UnparsedAttributes (Map.toList a) -- | 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+tagPredicate :: MonadCatch m => (Name -> Bool) -> AttrParser a -> (a -> ConduitParser Event m b) -> ConduitParser Event m b tagPredicate p attrParser = tag (guard . p) (const attrParser) -- | Like 'tag', but match a single tag name.-tagName :: (MonadCatch m) => Name -> AttrParser a -> (a -> ConduitParser Event m b) -> ConduitParser Event m b+tagName :: MonadCatch m => Name -> AttrParser a -> (a -> ConduitParser Event m b) -> ConduitParser Event m b tagName name = tagPredicate (== name) -- | Like 'tagName', but expect no attributes at all. tagNoAttr :: MonadCatch m => Name -> ConduitParser Event m a -> ConduitParser Event m a tagNoAttr name f = tagName name (return ()) $ const f++-- | Like 'tagName', but ignore all attributes.+tagIgnoreAttrs :: MonadCatch m => Name -> ConduitParser Event m a -> ConduitParser Event m a+tagIgnoreAttrs name f = tagName name ignoreAttrs $ const f -- | Parse an XML tag, whatever its name and attributes. --
xml-conduit-parse.cabal view
@@ -1,5 +1,5 @@ name: xml-conduit-parse-version: 0.3.0.0+version: 0.3.1.0 synopsis: Streaming XML parser based on conduits. description: This library provides an alternative, hopefully higher-level implementation for the parsing part of @xml-conduit@.