main :: IO ()
-main = do let fpath = "examples/tiny.xml"
+main = do let fpath = "examples/utf8.xml"
[hsMod] <- runX ( setErrorMsgHandler False fail
>>>
compileDocument :: ArrowXml a => a XmlTree (HsQualType, HsExp)
compileDocument = uniqueNamespacesFromDeclAndQNames
+ >>>
+ filterOutRootAttrs
>>>
( constA (HsQualType [] (HsTyCon (UnQual (HsIdent "XmlTree"))))
&&&
)
+filterOutRootAttrs :: ArrowXml a => a XmlTree XmlTree
+filterOutRootAttrs = processTopDownUntil (clearAttrs `when` isRoot)
+ where
+ clearAttrs = processAttrl none
+
+
wrapIntoModule :: Arrow a => a (Module, ([HsImportDecl], (HsName, (HsQualType, HsExp)))) HsModule
wrapIntoModule = proc (modName, (extImports, (symName, (symType, symExp)))) ->
do let hsModule = HsModule undefined modName (Just exports) imports decls