import qualified TSN.XML.News as News ( dtd, pickle_message )
import qualified TSN.XML.Odds as Odds ( dtd, pickle_message )
import qualified TSN.XML.Scores as Scores ( dtd, pickle_message )
-import qualified TSN.XML.SportInfo as SportInfo ( dtds )
+import qualified TSN.XML.SportInfo as SportInfo ( dtds, parse_xml )
import qualified TSN.XML.Weather as Weather ( dtd, pickle_message )
import Xml ( DtdName(..), parse_opts )
let m = unpickleDoc AutoRacingSchedule.pickle_message xml
maybe (return $ ImportFailed errmsg) migrate_and_import m
+ -- GameInfo and SportInfo appear least in the guards
| dtd == Injuries.dtd = do
let m = unpickleDoc Injuries.pickle_message xml
maybe (return $ ImportFailed errmsg) migrate_and_import m
let m = unpickleDoc Scores.pickle_message xml
maybe (return $ ImportFailed errmsg) migrate_and_import m
+ -- SportInfo and GameInfo appear least in the guards
| dtd == Weather.dtd = do
let m = unpickleDoc Weather.pickle_message xml
maybe (return $ ImportFailed errmsg) migrate_and_import m
Left err -> return $ ImportFailed err
Right m -> migrate_and_import m
- | dtd `elem` SportInfo.dtds = undefined
+ | dtd `elem` SportInfo.dtds = do
+ let either_m = SportInfo.parse_xml dtd xml
+ case either_m of
+ -- This might give us a slightly better error
+ -- message than the default 'errmsg'.
+ Left err -> return $ ImportFailed err
+ Right m -> migrate_and_import m
| otherwise = do
let infomsg =