-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A simple XML library. -- -- A simple XML library. @package xml @version 1.3.1 module Text.XML.Light.Types -- | A line is an Integer type Line = Integer -- | XML content data Content Elem :: Element -> Content Text :: CData -> Content CRef :: String -> Content -- | XML elements data Element Element :: QName -> [Attr] -> [Content] -> Maybe Line -> Element elName :: Element -> QName elAttribs :: Element -> [Attr] elContent :: Element -> [Content] elLine :: Element -> Maybe Line -- | XML attributes data Attr Attr :: QName -> String -> Attr attrKey :: Attr -> QName attrVal :: Attr -> String -- | XML CData data CData CData :: CDataKind -> String -> Maybe Line -> CData cdVerbatim :: CData -> CDataKind cdData :: CData -> String cdLine :: CData -> Maybe Line data CDataKind -- | Ordinary character data; pretty printer escapes &, < etc. CDataText :: CDataKind -- | Unescaped character data; pretty printer embeds it in <![CDATA[.. CDataVerbatim :: CDataKind -- | As-is character data; pretty printer passes it along without any -- escaping or CDATA wrap-up. CDataRaw :: CDataKind -- | XML qualified names data QName QName :: String -> Maybe String -> Maybe String -> QName qName :: QName -> String qURI :: QName -> Maybe String qPrefix :: QName -> Maybe String -- | Blank names blank_name :: QName -- | Blank cdata blank_cdata :: CData -- | Blank elements blank_element :: Element instance Show QName instance Eq CDataKind instance Show CDataKind instance Show CData instance Eq Attr instance Ord Attr instance Show Attr instance Show Element instance Show Content instance Ord QName instance Eq QName module Text.XML.Light.Proc -- | Get the text value of an XML element. This function ignores non-text -- elements, and concatenates all text elements. strContent :: Element -> String -- | Select only the elements from a list of XML content. onlyElems :: [Content] -> [Element] -- | Select only the elements from a parent. elChildren :: Element -> [Element] -- | Select only the text from a list of XML content. onlyText :: [Content] -> [CData] -- | Find all immediate children with the given name. findChildren :: QName -> Element -> [Element] -- | Filter all immediate children wrt a given predicate. filterChildren :: (Element -> Bool) -> Element -> [Element] -- | Filter all immediate children wrt a given predicate over their names. filterChildrenName :: (QName -> Bool) -> Element -> [Element] -- | Find an immediate child with the given name. findChild :: QName -> Element -> Maybe Element -- | Find an immediate child with the given name. filterChild :: (Element -> Bool) -> Element -> Maybe Element -- | Find an immediate child with name matching a predicate. filterChildName :: (QName -> Bool) -> Element -> Maybe Element -- | Find the left-most occurrence of an element matching given name. findElement :: QName -> Element -> Maybe Element -- | Filter the left-most occurrence of an element wrt. given predicate. filterElement :: (Element -> Bool) -> Element -> Maybe Element -- | Filter the left-most occurrence of an element wrt. given predicate. filterElementName :: (QName -> Bool) -> Element -> Maybe Element -- | Find all non-nested occurances of an element. (i.e., once we have -- found an element, we do not search for more occurances among the -- element's children). findElements :: QName -> Element -> [Element] -- | Find all non-nested occurrences of an element wrt. given predicate. -- (i.e., once we have found an element, we do not search for more -- occurances among the element's children). filterElements :: (Element -> Bool) -> Element -> [Element] -- | Find all non-nested occurences of an element wrt a predicate over -- element names. (i.e., once we have found an element, we do not search -- for more occurances among the element's children). filterElementsName :: (QName -> Bool) -> Element -> [Element] -- | Lookup the value of an attribute. findAttr :: QName -> Element -> Maybe String -- | Lookup attribute name from list. lookupAttr :: QName -> [Attr] -> Maybe String module Text.XML.Light.Output -- | Adds the ?xml? header. showTopElement :: Element -> String showContent :: Content -> String showElement :: Element -> String showCData :: CData -> String showQName :: QName -> String showAttr :: Attr -> String -- | Pretty printing renders XML documents faithfully, with the exception -- that whitespace may be added/removed in non-verbatim character data. ppTopElement :: Element -> String -- | Pretty printing content ppContent :: Content -> String -- | Pretty printing elements ppElement :: Element -> String tagEnd :: QName -> ShowS -- | The XML 1.0 header xml_header :: String -- | Lightweight XML parsing module Text.XML.Light.Input -- | parseXML to a list of content chunks parseXML :: String -> [Content] -- | parseXMLDoc, parse a XMLl document to maybe an element parseXMLDoc :: String -> Maybe Element instance Show Txt instance Show Token -- | an XML document. This implemntation is based on the general tree -- zipper written by Krasimir Angelov and Iavor S. Diatchki. module Text.XML.Light.Cursor data Tag Tag :: QName -> [Attr] -> Maybe Line -> Tag tagName :: Tag -> QName tagAttribs :: Tag -> [Attr] tagLine :: Tag -> Maybe Line getTag :: Element -> Tag setTag :: Tag -> Element -> Element fromTag :: Tag -> [Content] -> Element -- | The position of a piece of content in an XML document. data Cursor Cur :: Content -> [Content] -> [Content] -> Path -> Cursor -- | The currently selected content. current :: Cursor -> Content -- | Siblings on the left, closest first. lefts :: Cursor -> [Content] -- | Siblings on the right, closest first. rights :: Cursor -> [Content] -- | The contexts of the parent elements of this location. parents :: Cursor -> Path type Path = [([Content], Tag, [Content])] -- | A cursor for the guven content. fromContent :: Content -> Cursor -- | A cursor for the guven element. fromElement :: Element -> Cursor -- | The location of the first tree in a forest. fromForest :: [Content] -> Maybe Cursor -- | Computes the forest containing this location. toForest :: Cursor -> [Content] -- | Computes the tree containing this location. toTree :: Cursor -> Content -- | The parent of the given location. parent :: Cursor -> Maybe Cursor -- | The top-most parent of the given location. root :: Cursor -> Cursor -- | The child with the given index (starting from 0). getChild :: Int -> Cursor -> Maybe Cursor -- | The first child of the given location. firstChild :: Cursor -> Maybe Cursor -- | The last child of the given location. lastChild :: Cursor -> Maybe Cursor -- | The left sibling of the given location. left :: Cursor -> Maybe Cursor -- | The right sibling of the given location. right :: Cursor -> Maybe Cursor -- | The first child that satisfies a predicate. findChild :: (Cursor -> Bool) -> Cursor -> Maybe Cursor -- | Find the next left sibling that satisfies a predicate. findLeft :: (Cursor -> Bool) -> Cursor -> Maybe Cursor -- | Find the next right sibling that satisfies a predicate. findRight :: (Cursor -> Bool) -> Cursor -> Maybe Cursor -- | Are we at the top of the document? isRoot :: Cursor -> Bool -- | Are we at the left end of the the document? isFirst :: Cursor -> Bool -- | Are we at the right end of the document? isLast :: Cursor -> Bool -- | Are we at the bottom of the document? isLeaf :: Cursor -> Bool -- | Do we have a parent? isChild :: Cursor -> Bool -- | Do we have children? hasChildren :: Cursor -> Bool -- | Get the node index inside the sequence of children getNodeIndex :: Cursor -> Int -- | Change the current content. setContent :: Content -> Cursor -> Cursor -- | Modify the current content. modifyContent :: (Content -> Content) -> Cursor -> Cursor -- | Modify the current content, allowing for an effect. modifyContentM :: (Monad m) => (Content -> m Content) -> Cursor -> m Cursor -- | Insert content to the left of the current position. insertLeft :: Content -> Cursor -> Cursor -- | Insert content to the right of the current position. insertRight :: Content -> Cursor -> Cursor -- | Insert content to the left of the current position. The new content -- becomes the current position. insertGoLeft :: Content -> Cursor -> Cursor -- | Insert content to the right of the current position. The new content -- becomes the current position. insertGoRight :: Content -> Cursor -> Cursor -- | Remove the conent on the left of the current position, if any. removeLeft :: Cursor -> Maybe (Content, Cursor) -- | Remove the conent on the right of the current position, if any. removeRight :: Cursor -> Maybe (Content, Cursor) -- | Remove the current element. The new position is the one on the left. removeGoLeft :: Cursor -> Maybe Cursor -- | Remove the current element. The new position is the one on the right. removeGoRight :: Cursor -> Maybe Cursor -- | Remove the current element. The new position is the parent of the old -- position. removeGoUp :: Cursor -> Maybe Cursor instance Show Cursor instance Show Tag -- | A lightweight XML parsing, filtering and generating library. -- -- This module reexports functions from: -- --
module Text.XML.Light -- | Add an attribute to an element. add_attr :: Attr -> Element -> Element -- | Add some attributes to an element. add_attrs :: [Attr] -> Element -> Element -- | Create an unqualified name. unqual :: String -> QName -- | A smart element constructor which uses the type of its argument to -- determine what sort of element to make. class Node t node :: (Node t) => QName -> t -> Element -- | Create node with unqualified name unode :: (Node t) => String -> t -> Element instance Node [Char] instance Node (Attr, String) instance Node ([Attr], String) instance Node CData instance Node [CData] instance Node (Attr, CData) instance Node ([Attr], CData) instance Node ([Attr], [CData]) instance Node Element instance Node [Element] instance Node (Attr, Element) instance Node ([Attr], Element) instance Node ([Attr], [Element]) instance Node (Attr, Content) instance Node ([Attr], Content) instance Node Content instance Node [Content] instance Node () instance Node Attr instance Node [Attr] instance Node ([Attr], [Content])