]> gitweb.michael.orlitzky.com - dead/htsn-import.git/blobdiff - src/Main.hs
Add a function to TSN.XML.Weather to detect the unsupported second type.
[dead/htsn-import.git] / src / Main.hs
index fc6d14b8a116aef185d0c7d362b2204c912ff135..0fe6096e867631e4ea0ddae439324d891fd037f2 100644 (file)
@@ -65,7 +65,7 @@ import qualified TSN.XML.ScheduleChanges as ScheduleChanges (
   pickle_message )
 import qualified TSN.XML.Scores as Scores ( dtd, pickle_message )
 import qualified TSN.XML.SportInfo as SportInfo ( dtds, parse_xml )
-import qualified TSN.XML.Weather as Weather ( dtd, pickle_message )
+import qualified TSN.XML.Weather as Weather ( dtd, is_type1, pickle_message )
 import Xml ( DtdName(..), parse_opts )
 
 
@@ -203,7 +203,14 @@ import_file cfg path = do
             | dtd == Scores.dtd = go Scores.pickle_message
 
             -- SportInfo and GameInfo appear last in the guards
-            | dtd == Weather.dtd = go Weather.pickle_message
+            | dtd == Weather.dtd =
+                if Weather.is_type1 xml
+                then go Weather.pickle_message
+                else do
+                  -- We want these to "succeed" so that they're deleted.
+                  -- We already know we can't parse them.
+                  let msg = "Unsupported weatherxml.dtd type (" ++ path ++ ")"
+                  return $ ImportUnsupported msg
 
             | dtd `elem` GameInfo.dtds = do
                 let either_m = GameInfo.parse_xml dtd xml