The html-conduit package

[ Tags: conduit, library, mit, text, web ] [ Propose Tags ]

This package uses tagstream-conduit for its parser. It automatically balances mismatched tags, so that there shouldn't be any parse failures. It does not handle a full HTML document rendering, such as adding missing html and head tags.


[Skip to Readme]

Properties

Versions 0.0.0, 0.0.1, 0.1.0, 0.1.0.1, 0.1.0.2, 0.1.0.3, 0.1.0.4, 1.1.0, 1.1.0.1, 1.1.0.2, 1.1.0.3, 1.1.0.4, 1.1.0.5, 1.1.0.6, 1.1.1, 1.1.1.1, 1.1.1.2, 1.2.0, 1.2.1, 1.2.1.1, 1.2.1.2
Change log ChangeLog.md
Dependencies base (==4.*), bytestring, conduit (>=1.0 && <1.3), conduit-extra (>=1.1.1), containers, resourcet (>=0.3 && <1.2), tagstream-conduit (>=0.5.5.3 && <0.6), text, transformers, xml-conduit (>=1.3), xml-types (==0.3.*) [details]
License MIT
Author Michael Snoyman
Maintainer michael@snoyman.com
Category Web, Text, Conduit
Home page https://github.com/snoyberg/xml
Source repository head: git clone git://github.com/snoyberg/xml.conduit
Uploaded Wed Sep 27 09:55:40 UTC 2017 by MichaelSnoyman
Distributions Debian:1.2.1, FreeBSD:1.2.0, LTSHaskell:1.2.1.2, NixOS:1.2.1.1, Stackage:1.2.1.2, Tumbleweed:1.2.1.1
Downloads 21694 total (139 in the last 30 days)
Rating 0.0 (0 ratings) [clear rating]
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-09-27 [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for html-conduit-1.2.1.2

[back to package description]

This package uses tagstream-conduit for its parser. It automatically balances mismatched tags, so that there shouldn't be any parse failures. It does not handle a full HTML document rendering, such as adding missing html and head tags.

Simple usage example:

#!/usr/bin/env stack
{- stack --install-ghc --resolver lts-6.23 runghc
   --package http-conduit --package html-conduit
-}
{-# LANGUAGE OverloadedStrings #-}
import qualified Data.Text.IO        as T
import           Network.HTTP.Simple (httpSink)
import           Text.HTML.DOM       (sinkDoc)
import           Text.XML.Cursor     (attributeIs, content, element,
                                      fromDocument, ($//), (&/), (&//))

main :: IO ()
main = do
    doc <- httpSink "http://www.yesodweb.com/book" $ const sinkDoc
    let cursor = fromDocument doc
    T.putStrLn "Chapters in the Yesod book:\n"
    mapM_ T.putStrLn
      $ cursor
      $// attributeIs "class" "main-listing"
      &// element "li"
      &/ element "a"
      &/ content