atom-conduit-0.1.0.0: Streaming parser/renderer for the Atom 1.0 syndication format (RFC 4287).

Safe HaskellNone
LanguageHaskell2010

Text.Atom

Synopsis

Documentation

atomText :: Name -> Prism' Element AtomText

Example:

>>> let (Right doc) = parseText def "<foo>bar</foo>"
>>> doc ^? root . atomText "foo"
Just (AtomPlainText {atomPlainTextType_ = TypeText, atomPlainTextText_ = "bar"}])

atomPerson :: Name -> Prism' Element AtomPerson

Example:

>>> let (Right doc) = parseText def "<author><name>John Doe</name><email>john.doe@nobody.org</email><uri>https://jd.io</uri></author>"
>>> doc ^? root . atomPerson "author"
Just (AtomPerson "John Doe" (Just "john.doe@nobody.org") (Just https://jd.io))

atomCategory :: Prism' Element AtomCategory

Example:

>>> let (Right doc) = parseText def "<category term=\"foo\" scheme=\"bar\" label=\"baz\"/>"
>>> doc ^? root . atomCategory
Just (AtomCategory "foo" (Just "bar") (Just "baz"))

atomLink :: Prism' Element AtomLink

Example:

>>> let (Right doc) = parseText def "<link href=\"http://foo.io\" rel=\"alternate\" type=\"text/html\" hreflang=\"en\" title=\"foo\" length=\"1\"/>"
>>> doc ^? root . atomLink
Just (AtomLink http://foo.io (Just "alternate") (Just "text/html") (Just "en") (Just "foo") (Just "1"))