-- | Parse TSN XML for the DTD "newsxml.dtd". Each document contains a
-- root element \<message\> that contains an entire news item.
--
-module TSN.News (
+module TSN.XML.News (
Message,
news_tests )
where
data Message =
Message {
- db_xml_file_id :: Int,
- db_heading :: String,
db_mid :: MsgId,
- db_category :: String,
db_sport :: String,
db_url :: String,
db_sms :: String,
db_text :: String,
- db_continue :: String,
- db_time_stamp :: String }
+ db_continue :: String }
deriving (Eq, Show)
instance ToFromXml Message where
-- used our named fields.
to_xml (Message {..}) =
MessageXml
- db_xml_file_id
- db_heading
+ 0
+ ""
db_mid
- db_category
+ ""
db_sport
db_url
[]
db_sms
db_text
db_continue
- db_time_stamp
+ ""
-- We don't need the key argument (from_xml_fk) since the XML type
-- contains more information in this case.
- from_xml (MessageXml a b c d e f _ _ g h i j) =
- Message a b c d e f g h i j
+ from_xml (MessageXml _ _ c _ e f _ _ g h i _) =
+ Message c e f g h i
mkPersist tsn_codegen_config [groundhog|