dom-selector-0.1.0.0: DOM traversal by CSS selectors for xml-conduit package

Safe HaskellSafe-Infered

Text.XML.Scraping

Contents

Description

Scraping (innerHTML/innerText) and modification (node removal) functions.

Synopsis

InnerHTML / InnerText

innerHtml :: [Cursor] -> TextSource

Get ''innerHTML'' from a list of cursors.

innerText :: [Cursor] -> TextSource

Get ''innerText'' from a list of cursors.

renderNodes :: [Node] -> TextSource

''toHTML'' of a list of nodes.

toHtml :: [Cursor] -> TextSource

''toHTML'' of a list of cursors.

innerTextN :: Node -> TextSource

''innerText'' of a single node.

Attirbutes

ename :: Node -> Maybe TextSource

Tag name of element node. Return Nothing if the node is not an element.

eid :: Node -> Maybe TextSource

Return an element id. If node is not an element or does not have an id, return Nothing.

eclass :: Node -> [Text]Source

Return element classes. If node is not an element or does not have a class, return an empty list.

getMeta :: Text -> Cursor -> [Text]Source

Search a meta with a specified name under a cursor, and get a ''content'' field.

Removing Nodes

remove :: (Node -> Bool) -> Node -> NodeSource

Remove descendant nodes that satisfie predicate (''Destructive'').

removeDepth :: (Node -> Bool) -> Int -> Node -> NodeSource

Similar to remove, but with a depth.

removeTags :: [Text] -> [Node] -> [Node]Source

Remove elements with specified tags.

removeQuery :: String -> [Node] -> [Node]Source

Remove descendant nodes that match a query string.

removeQueries :: [String] -> [Node] -> [Node]Source

Remove descendant nodes that match any of query strings.

nodeHaving :: (Node -> Bool) -> Node -> BoolSource

See if the node contains any descendant (and self) node that satisfies predicate. To return false, this function needs to traverse all descendant elements....

rmElem :: String -> String -> [String] -> [Node] -> [Node]Source

Remove descendant nodes that match the condition (similar to remove)