hexpat-0.13: wrapper for expat, the fast XML parserSource codeContentsIndex
Text.XML.Expat.NodeClass
Description
A typeclass to allow for functions that work with different node types such as the ones defined in Tree and Annotated.
Synopsis
textContent :: (NodeClass n [], Monoid text) => n [] tag text -> text
class List c => NodeClass n c where
isElement :: n c tag text -> Bool
isText :: n c tag text -> Bool
textContentM :: Monoid text => n c tag text -> ItemM c text
isNamed :: Eq tag => tag -> n c tag text -> Bool
getName :: Monoid tag => n c tag text -> tag
getAttributes :: n c tag text -> [(tag, text)]
getChildren :: n c tag text -> c (n c tag text)
getText :: Monoid text => n c tag text -> text
modifyName :: (tag -> tag) -> n c tag text -> n c tag text
modifyAttributes :: ([(tag, text)] -> [(tag, text)]) -> n c tag text -> n c tag text
modifyChildren :: (c (n c tag text) -> c (n c tag text)) -> n c tag text -> n c tag text
mapAllTags :: (tag -> tag') -> n c tag text -> n c tag' text
mapElement :: ((tag, [(tag, text)], c (n c tag text)) -> (tag', [(tag', text)], c (n c tag' text))) -> n c tag text -> n c tag' text
mapNodeContainer :: (c (n c tag text) -> ItemM c (c' (n c' tag text))) -> n c tag text -> ItemM c (n c' tag text)
getAttribute :: (NodeClass n c, GenericXMLString tag) => n c tag text -> tag -> Maybe text
setAttribute :: (Eq tag, NodeClass n c, GenericXMLString tag) => tag -> text -> n c tag text -> n c tag text
deleteAttribute :: (Eq tag, NodeClass n c, GenericXMLString tag) => tag -> n c tag text -> n c tag text
alterAttribute :: (Eq tag, NodeClass n c, GenericXMLString tag) => tag -> Maybe text -> n c tag text -> n c tag text
Documentation
textContent :: (NodeClass n [], Monoid text) => n [] tag text -> textSource
Extract all text content from inside a tag into a single string, including any text contained in children.
class List c => NodeClass n c whereSource
Methods
isElement :: n c tag text -> BoolSource
Is the given node an element?
isText :: n c tag text -> BoolSource
Is the given node text?
textContentM :: Monoid text => n c tag text -> ItemM c textSource
Extract all text content from inside a tag into a single string, including any text contained in children.
isNamed :: Eq tag => tag -> n c tag text -> BoolSource
Is the given node a tag with the given name?
getName :: Monoid tag => n c tag text -> tagSource
Get the name of this node if it's an element, return empty string otherwise.
getAttributes :: n c tag text -> [(tag, text)]Source
Get the attributes of a node if it's an element, return empty list otherwise.
getChildren :: n c tag text -> c (n c tag text)Source
Get children of a node if it's an element, return empty list otherwise.
getText :: Monoid text => n c tag text -> textSource
Get this node's text if it's a text node, return empty text otherwise.
modifyName :: (tag -> tag) -> n c tag text -> n c tag textSource
Modify name if it's an element, no-op otherwise.
modifyAttributes :: ([(tag, text)] -> [(tag, text)]) -> n c tag text -> n c tag textSource
Modify attributes if it's an element, no-op otherwise.
modifyChildren :: (c (n c tag text) -> c (n c tag text)) -> n c tag text -> n c tag textSource
Modify children (non-recursively) if it's an element, no-op otherwise.
mapAllTags :: (tag -> tag') -> n c tag text -> n c tag' textSource
Map all tags (both tag names and attribute names) recursively.
mapElement :: ((tag, [(tag, text)], c (n c tag text)) -> (tag', [(tag', text)], c (n c tag' text))) -> n c tag text -> n c tag' textSource
Map an element non-recursively, allowing the tag type to be changed.
mapNodeContainer :: (c (n c tag text) -> ItemM c (c' (n c' tag text))) -> n c tag text -> ItemM c (n c' tag text)Source
Change a node from one container type to another.
show/hide Instances
(Functor c, List c) => NodeClass NodeG c
(Functor c, List c) => NodeClass (NodeG a) c
getAttribute :: (NodeClass n c, GenericXMLString tag) => n c tag text -> tag -> Maybe textSource
Get the value of the attribute having the specified name.
setAttribute :: (Eq tag, NodeClass n c, GenericXMLString tag) => tag -> text -> n c tag text -> n c tag textSource
Set the value of the attribute with the specified name to the value, overwriting the first existing attribute with that name if present.
deleteAttribute :: (Eq tag, NodeClass n c, GenericXMLString tag) => tag -> n c tag text -> n c tag textSource
Delete the first attribute matching the specified name.
alterAttribute :: (Eq tag, NodeClass n c, GenericXMLString tag) => tag -> Maybe text -> n c tag text -> n c tag textSource
setAttribute if Just, deleteAttribute if Nothing.
Produced by Haddock version 2.6.1