fast-tagsoup-1.0.14: Fast parsing and extracting information from (possibly malformed) HTML/XML documents

Safe HaskellNone
LanguageHaskell98

Text.HTML.TagSoup.Fast

Contents

Description

Very fast TagSoup parser.

Works only with strict bytestrings. Correctly handles HTML <script> and <style> tags.

This module is intended to be used in conjunction with the original tagsoup package:

import Text.HTML.TagSoup hiding (parseTags, renderTags)
import Text.HTML.TagSoup.Fast

Remark that tags are returned in lower case and comments are not returned.

In long running multithreaded applications it's generally recommended to use parseTagsT and work with [Tag Text] to reduce memory fragmentation.

Synopsis

Documentation

parseTags :: ByteString -> [Tag ByteString] Source #

Parse a string to a list of tags.

parseTags "<div>&amp;<script>x<y</script>" ==
  [TagOpen "div" [],TagText "&",TagOpen "script" [],TagText "x<y",TagClose "script"]

renderTags :: [Tag ByteString] -> ByteString Source #

Show a list of tags, as they might have been parsed.

parseTagsT :: ByteString -> [Tag Text] Source #

Alternative to parseTags working with Text

renderTagsT :: [Tag Text] -> Text Source #

Alternative to renderTags working with Text

ensureUtf8Xml :: ByteString -> ByteString Source #

Decode XML to UTF-8 using encoding attribute of <?xml> tag.

escapeHtml :: ByteString -> ByteString Source #

Escape characters unsafe to HTML

escapeHtmlT :: Text -> Text Source #

Alternative to escapeHtml working with Text

unescapeHtml :: ByteString -> ByteString Source #

Convert escaped HTML to raw.

unescapeHtmlT :: Text -> Text Source #

Alternative to unescapeHtml working with Text

Orphan instances