-import Network.Services.TSN.Report ( report_error )
-import TSN.Codegen ( tsn_codegen_config )
-import TSN.DbImport ( DbImport(..) )
-import Xml ( ToFromXml(..), pickle_unpickle )
-
-
-
--- | The database type for teams as they show up in the news. We need
--- this separate from its XML representation because of the
--- DefaultKey pointing to a message. We don't know how to create one
--- of those unless we've just inserted a message into the database,
--- so it screws up pickling.
-data NewsTeam =
- NewsTeam {
- nt_news_id :: DefaultKey Message, -- ^ foreign key.
- db_team_name :: String }
-deriving instance Eq NewsTeam -- Standalone instances necessary for
-deriving instance Show NewsTeam -- Groundhog types with DefaultKeys
-
--- | The XML type for teams as they show up in the news. See
--- 'NewsTeam' for why there are two types.
-data NewsTeamXml =
- NewsTeamXml {
- xml_team_name :: String }
- deriving (Eq, Show)
-
--- | Specify how to convert between the two representations NewsTeam
--- (database) and NewsTeamXml (XML).
-instance ToFromXml NewsTeam where
- type Xml NewsTeam = NewsTeamXml
- type Container NewsTeam = Message
- -- Use a record wildcard here so GHC doesn't complain that we never
- -- used our named fields.
- to_xml (NewsTeam {..}) = NewsTeamXml db_team_name
- -- We can't create a DefaultKey Message...
- from_xml = error "Called from_xml on a NewsTeam"
- -- unless we're handed one.
- from_xml_fk key = (NewsTeam key) . xml_team_name
-
-
--- | The database type for locations as they show up in the news. We
--- need this separate from its XML representation because of the
--- DefaultKey pointing to a message. We don't know how to create one
--- of those unless we've just inserted a message into the database,
--- so it screws up pickling.
-data NewsLocation =
- NewsLocation {
- loc_news_id :: DefaultKey Message, -- ^ foreign key.
- db_city ::String,
- db_state :: String,
- db_country :: String }
-deriving instance Eq NewsLocation -- Standalone instances necessary for
-deriving instance Show NewsLocation -- Groundhog types with DefaultKeys
-
--- | The XML type for locations as they show up in the news. See
--- 'NewsLocation' for why there are two types.
-data NewsLocationXml =
- NewsLocationXml {
- xml_city :: String,
- xml_state :: String,
- xml_country :: String }
- deriving (Eq, Show)
+-- Local imports.
+import TSN.Codegen (
+ tsn_codegen_config,
+ tsn_db_field_namer ) -- Used in a test
+import TSN.Database ( insert_or_select )
+import TSN.DbImport ( DbImport(..), ImportResult(..), run_dbmigrate )
+import TSN.Picklers ( xp_time_stamp )
+import TSN.XmlImport ( XmlImport(..) )
+import Xml (
+ FromXml(..),
+ ToDb(..),
+ pickle_unpickle,
+ unpickleable,
+ unsafe_unpickle )
+
+
+-- | The DTD to which this module corresponds. Used to invoke dbimport.
+--
+dtd :: String
+dtd = "newsxml.dtd"