import qualified TSN.XML.Injuries as Injuries ( Message )
import qualified TSN.XML.InjuriesDetail as InjuriesDetail ( Message )
import qualified TSN.XML.News as News ( Message )
---import qualified TSN.XML.Odds as Odds ( Odds )
+import qualified TSN.XML.Odds as Odds ( Message )
import Xml ( DtdName(..), parse_opts )
-- We special-case the heartbeat so it doesn't have to run in
-- the database monad.
| dtd == "Heartbeat.dtd" = Heartbeat.verify xml
- | otherwise = do
+ | otherwise =
-- We need NoMonomorphismRestriction here.
if backend cfg == Postgres
- then withPostgresqlConn cs $ runDbConn $ importer
- else withSqliteConn cs $ runDbConn $ importer
+ then withPostgresqlConn cs $ runDbConn importer
+ else withSqliteConn cs $ runDbConn importer
where
-- | Pull the real connection String out of the configuration.
cs :: String
let errmsg = "Could not unpickle newsxml."
maybe (return $ ImportFailed errmsg) migrate_and_import m
- -- | dtd == "Odds_XML.dtd" = undefined
+ | dtd == "Odds_XML.dtd" = do
+ let m = unpickleDoc xpickle xml :: Maybe Odds.Message
+ let errmsg = "Could not unpickle Odds_XML."
+ maybe (return $ ImportFailed errmsg) migrate_and_import m
| otherwise = do
let infomsg =