]> gitweb.michael.orlitzky.com - dead/htsn-import.git/blobdiff - src/Xml.hs
Add tests for TSN.XML.GameInfo.
[dead/htsn-import.git] / src / Xml.hs
index 780a64e6473815ecd0ec88d4257e4d1ce231373c..e7d47a12c319617d9a70c8e7d8f6a8cead7eae81 100644 (file)
@@ -11,6 +11,7 @@ module Xml (
   parse_opts,
   pickle_unpickle,
   unpickleable,
+  unsafe_read_document,
   unsafe_unpickle )
 where
 
@@ -22,6 +23,7 @@ import Text.XML.HXT.Core (
   (/>),
   PU,
   SysConfigList,
+  XmlTree,
   isElem,
   no,
   readDocument,
@@ -153,3 +155,11 @@ unpickleable filepath unpickler = do
 unsafe_unpickle :: FilePath -> PU a -> IO a
 unsafe_unpickle filepath unpickler =
   fmap head $ runX $ xunpickleDocument unpickler parse_opts filepath
+
+
+-- | Read an XML document from a 'FilePath' into an XmlTree. Explode if it
+--   doesn't work.
+--
+unsafe_read_document :: FilePath -> IO XmlTree
+unsafe_read_document filepath =
+  fmap head $ runX $ readDocument parse_opts filepath