-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | translate xml to json
--
-- translate xml to json
@package xml2json
@version 0.2.0.0
module Text.XML.ToJSON.Builder
-- | represent a XML element.
data Element
Element :: [(Text, Text)] -> [Text] -> [(Text, Element)] -> Element
-- | tag attributes.
elAttrs :: Element -> [(Text, Text)]
-- | text values.
elValues :: Element -> [Text]
-- | child elements.
elChildren :: Element -> [(Text, Element)]
emptyElement :: Element
-- | add a child element to an element
addChild' :: (Text, Element) -> Element -> Element
-- | add a text value to an element
addValue' :: Text -> Element -> Element
-- | add an attribute to an element
addAttr' :: (Text, Text) -> Element -> Element
-- | add multiple attributes to an element
addAttrs' :: [(Text, Text)] -> Element -> Element
-- | xml element stack with recent opened element at the top.
type Stack = [(Text, Element)]
-- | close current tag.
popStack :: Stack -> Stack
-- | close all unclosed tags and return the root element.
closeStack :: Stack -> Element
-- | Builder is a State monad to transform a Stack.
type Builder = State Stack ()
-- | exec the state monad and close the result stack.
runBuilder :: Builder -> Element
-- | open element
beginElement :: Text -> Builder
-- | close element
endElement :: Builder
-- | util to modify top element.
modifyTopElement :: (Element -> Element) -> Builder
-- | add child element to top element.
addChild :: (Text, Element) -> Builder
-- | add value to top element.
addValue :: Text -> Builder
-- | add attribute to top element.
addAttr :: (Text, Text) -> Builder
-- | add multiple attributes to top element.
addAttrs :: [(Text, Text)] -> Builder
instance Show Element
module Text.XML.ToJSON
-- | parse xml to haskell data type by using aeson's FromJSON.
parseXML :: (MonadThrow m, FromJSON a) => ByteString -> m a
-- | convert lazy xml ByteString to aeson Value.
xmlToJSON :: MonadThrow m => ByteString -> m Value
data JSONParseError
-- | Consume a source and convert the content to aeson Value, it try
-- to inspect xml encoding from first tag.
--
-- e.g. bsSourceToJSON (C.sourceFile path_to_xml_file)
bsSourceToJSON :: MonadThrow m => Source m ByteString -> m Value
-- | Consume a source and convert the content to aeson Value, it try
-- to inspect xml encoding from first tag.
--
-- e.g. xmlStreamToJSONResumable (requestBody req)
bsRSourceToJSON :: MonadThrow m => ResumableSource m ByteString -> m Value
-- | Convert tagstream-conduit Token to xml element Builder
tokenToBuilder :: Token -> Builder
-- | Convert xml Element to aeson Value .
--
-- xml attributes and text values are converted to special object
-- attribute __attributes and __values.
elementToJSON :: Element -> Value
-- | Convert list of tagstream-conduit Token to aeson Value
tokensToJSON :: [Token] -> Value
instance Typeable JSONParseError
instance Show JSONParseError
instance Exception JSONParseError