-- | Extra library functions for HXT.
module Text.XML.HXT.Extras(
                     showPickled,
                     textAttr
                   ) where

import Text.XML.HXT.Arrow

-- | Pickles a value then writes the document to a string.
showPickled :: (XmlPickler a) => Attributes -> a -> String
showPickled a = concat . (pickleDoc xpickle >>> runLA (writeDocumentToString a))

-- | A text attribute
textAttr :: String -> PU String
textAttr = flip xpAttr xpText