module Text.XML.HaXml.Util
(
docContent
, contentElem
, attrs
, tagTextContent
) where
import Text.XML.HaXml.Types
import Text.XML.HaXml.Verbatim
docContent :: i -> Document i -> Content i
docContent :: forall i. i -> Document i -> Content i
docContent i
i (Document Prolog
_ SymTab EntityDef
_ Element i
e [Misc]
_) = Element i -> i -> Content i
forall i. Element i -> i -> Content i
CElem Element i
e i
i
contentElem :: Content i -> Element i
contentElem :: forall i. Content i -> Element i
contentElem (CElem Element i
e i
_) = Element i
e
contentElem Content i
_ = [Char] -> Element i
forall a. HasCallStack => [Char] -> a
error [Char]
"content is not a CElem"
attrs :: Element i -> [Attribute]
attrs :: forall i. Element i -> [Attribute]
attrs ( Elem QName
_ [Attribute]
attrs [Content i]
_ ) = [Attribute]
attrs
tagTextContent :: Content i -> [Char]
tagTextContent :: forall i. Content i -> [Char]
tagTextContent ((CElem (Elem QName
_ [Attribute]
_ [Content i]
cs) i
_)) = (Content i -> [Char]) -> [Content i] -> [Char]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Content i -> [Char]
forall a. Verbatim a => a -> [Char]
verbatim [Content i]
cs