Text.Pandoc.XML.Light.Proc

pandoc-3.7.0.2: Conversion between markup formats

Copyright | Copyright (C) 2007 Galois Inc. 2021-2024 John MacFarlane
License | GNU GPL, version 2 or above
Maintainer | John MacFarlane <jgm@berkeley.edu>
Stability | alpha
Portability | portable
Safe Haskell | Safe-Inferred
Language | Haskell2010

Text.Pandoc.XML.Light.Proc

Contents

- Replacement for xml-light's Text.XML.Proc

Description

This code is taken from xml-light, released under the BSD3 license.

Synopsis

- strContent :: Element -> Text
- onlyElems :: [Content] -> [Element]
- elChildren :: Element -> [Element]
- onlyText :: [Content] -> [CData]
- findChildren :: QName -> Element -> [Element]
- filterChildren :: (Element -> Bool) -> Element -> [Element]
- filterChildrenName :: (QName -> Bool) -> Element -> [Element]
- findChild :: QName -> Element -> Maybe Element
- filterChild :: (Element -> Bool) -> Element -> Maybe Element
- filterChildName :: (QName -> Bool) -> Element -> Maybe Element
- findElement :: QName -> Element -> Maybe Element
- filterElement :: (Element -> Bool) -> Element -> Maybe Element
- filterElementName :: (QName -> Bool) -> Element -> Maybe Element
- findElements :: QName -> Element -> [Element]
- filterElements :: (Element -> Bool) -> Element -> [Element]
- filterElementsName :: (QName -> Bool) -> Element -> [Element]
- findAttr :: QName -> Element -> Maybe Text
- lookupAttr :: QName -> [Attr] -> Maybe Text
- lookupAttrBy :: (QName -> Bool) -> [Attr] -> Maybe Text
- findAttrBy :: (QName -> Bool) -> Element -> Maybe Text

# Replacement for xml-light's Text.XML.Proc

strContent :: Element -> Text #

Get the text value of an XML element. This function ignores non-text elements, and concatenates all text elements.

onlyElems :: [Content] -> [Element] #

Select only the elements from a list of XML content.

elChildren :: Element -> [Element] #

Select only the elements from a parent.

onlyText :: [Content] -> [CData] #

Select only the text from a list of XML content.

findChildren :: QName -> Element -> [Element] #

Find all immediate children with the given name.

filterChildren :: (Element -> Bool) -> Element -> [Element] #

Filter all immediate children wrt a given predicate.

filterChildrenName :: (QName -> Bool) -> Element -> [Element] #

Filter all immediate children wrt a given predicate over their names.

findChild :: QName -> Element -> Maybe Element #

Find an immediate child with the given name.

filterChild :: (Element -> Bool) -> Element -> Maybe Element #

Find an immediate child with the given name.

filterChildName :: (QName -> Bool) -> Element -> Maybe Element #

Find an immediate child with name matching a predicate.

findElement :: QName -> Element -> Maybe Element #

Find the left-most occurrence of an element matching given name.

filterElement :: (Element -> Bool) -> Element -> Maybe Element #

Filter the left-most occurrence of an element wrt. given predicate.

filterElementName :: (QName -> Bool) -> Element -> Maybe Element #

Filter the left-most occurrence of an element wrt. given predicate.

findElements :: QName -> Element -> [Element] #

Find all non-nested occurrences of an element. (i.e., once we have found an element, we do not search for more occurrences among the element's children).

filterElements :: (Element -> Bool) -> 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 occurrences among the element's children).

filterElementsName :: (QName -> Bool) -> Element -> [Element] #

Find all non-nested occurrences of an element wrt a predicate over element names. (i.e., once we have found an element, we do not search for more occurrences among the element's children).

findAttr :: QName -> Element -> Maybe Text #

Lookup the value of an attribute.

lookupAttr :: QName -> [Attr] -> Maybe Text #

Lookup attribute name from list.

lookupAttrBy :: (QName -> Bool) -> [Attr] -> Maybe Text #

Lookup the first attribute whose name satisfies the given predicate.

findAttrBy :: (QName -> Bool) -> Element -> Maybe Text #

Lookup the value of the first attribute whose name satisfies the given predicate.