tagsoup-selection-0.1.0.1: Selecting subtrees from TagSoup's TagTrees using CSS selectors

Safe HaskellNone
LanguageHaskell98

Text.HTML.TagSoup.Tree.Util

Description

Utility functions for TagSoup's TagTree.

Synopsis

Documentation

children :: TagTree str -> [TagTree str] Source #

Returns all immediate children of a TagTree.

descendants :: TagTree str -> [TagTree str] Source #

Returns all immediate children, the children of these children etc. for a TagTree.

withTagTree :: (str -> [Attribute str] -> [TagTree str] -> a) -> (Tag str -> a) -> TagTree str -> a Source #

Case analysis for TagTree values.

isTagBranch :: TagTree str -> Bool Source #

Checks if the given tree is a TagBranch.

isTagLeaf :: TagTree str -> Bool Source #

Checks if the given tree is a TagLeaf.

tagBranchName :: TagTree str -> str Source #

Returns the element name of a TagBranch, or an error if the tree is a TagLeaf.

tagBranchAttrs :: TagTree str -> [Attribute str] Source #

Returns the attribute list of a TagBranch, or an error if the tree is a TagLeaf.

tagBranchTrees :: TagTree str -> [TagTree str] Source #

Returns the subtrees of a TagBranch, or an error if the tree is a TagLeaf.

fromTagLeaf :: TagTree str -> Tag str Source #

Returns the inner Tag value if the tree is a TagLeaf, or an error otherwise.

hasTagBranchName :: Eq str => str -> TagTree str -> Bool Source #

hasTagBranchAttr :: Eq str => str -> TagTree str -> Bool Source #

findTagBranchAttr :: Eq str => str -> TagTree str -> Maybe str Source #

tagTree' :: StringLike str => [Tag str] -> [TagTree str] Source #

An alternative tagTree version. The original version sometimes yields unsatisfying results if the tag soup includes several spurious opening or closing tags. This version tries harder to balance them properly.

htmlRoot :: [TagTree String] -> TagTree String Source #

Tries to find the html branch in a TagTree. If no branch with that name exists, a new html branch is returned with the input trees as its immediate children.