4 author: Michael Orlitzky
5 maintainer: Michael Orlitzky <michael@orlitzky.com>
8 license-file: doc/LICENSE
12 doc/htsn-importrc.example
13 doc/man1/htsn-import.1
15 doc/README.development
20 schemagen/Auto_Racing_Schedule_XML/*.xml
21 schemagen/Heartbeat/*.xml
22 schemagen/injuriesxml/*.xml
23 schemagen/Injuries_Detail_XML/*.xml
24 schemagen/newsxml/*.xml
25 schemagen/Odds_XML/*.xml
26 schemagen/scoresxml/*.xml
27 schemagen/weatherxml/*.xml
32 Import XML files from The Sports Network into an RDBMS.
37 htsn-import [OPTIONS] [FILES]
40 The Sports Network <http://www.sportsnetwork.com/> offers an XML feed
41 containing various sports news and statistics. Our sister program
42 /htsn/ is capable of retrieving the feed and saving the individual
43 XML documents contained therein. But what to do with them?
45 The purpose of /htsn-import/ is to take these XML documents and
46 get them into something we can use, a relational database management
47 system (RDBMS), loosely known as a SQL database. The structure of
48 relational database, is, well, relational, and the feed XML is not. So
49 there is some work to do before the data can be inserted.
51 First, we must parse the XML. Each supported document type (see below)
52 has a full pickle/unpickle implementation (\"pickle\" is simply a
53 synonym for serialize here). That means that we parse the entire
54 document into a data structure, and if we pickle (serialize) that data
55 structure, we get the exact same XML document tha we started with.
57 This is important for two reasons. First, it serves as a second level
58 of validation. The first validation is performed by the XML parser,
59 but if that succeeds and unpicking fails, we know that something is
60 fishy. Second, we don't ever want to be surprised by some new element
61 or attribute showing up in the XML. The fact that we can unpickle the
62 whole thing now means that we won't be surprised in the future.
64 The aforementioned feature is especially important because we
65 automatically migrate the database schema every time we import a
66 document. If you attempt to import a \"newsxml.dtd\" document, all
67 database objects relating to the news will be created if they do not
68 exist. We don't want the schema to change out from under us without
69 warning, so it's important that no XML be parsed that would result in
70 a different schema than we had previously. Since we can
71 pickle/unpickle everything already, this should be impossible.
73 Examples and usage documentation are available in the man page.
75 executable htsn-import
86 groundhog-postgresql >= 0.5,
87 groundhog-sqlite >= 0.5,
110 OptionalConfiguration
117 TSN.XML.AutoRacingResults
118 TSN.XML.AutoRacingSchedule
122 TSN.XML.InjuriesDetail
133 -fwarn-missing-signatures
134 -fwarn-name-shadowing
138 -fwarn-incomplete-record-updates
139 -fwarn-monomorphism-restriction
140 -fwarn-unused-do-bind
147 -- The following unbreak profiling with template haskell. We have
148 -- to build the program twice; once without profile and again with
155 type: exitcode-stdio-1.0
156 hs-source-dirs: src test
157 main-is: TestSuite.hs
165 htsn-common >= 0.0.1,
168 groundhog-postgresql >= 0.5,
169 groundhog-sqlite >= 0.5,
180 -- It's not entirely clear to me why I have to reproduce all of this.
184 -fwarn-missing-signatures
185 -fwarn-name-shadowing
189 -fwarn-incomplete-record-updates
190 -fwarn-monomorphism-restriction
191 -fwarn-unused-do-bind
196 type: exitcode-stdio-1.0
201 -- Additional test dependencies.
204 -- It's not entirely clear to me why I have to reproduce all of this.
208 -fwarn-missing-signatures
209 -fwarn-name-shadowing
213 -fwarn-incomplete-record-updates
214 -fwarn-monomorphism-restriction
215 -fwarn-unused-do-bind
223 -- These won't work without shelltestrunner installed in your
224 -- $PATH. Maybe there is some way to tell Cabal that.
225 test-suite shelltests
226 type: exitcode-stdio-1.0
228 main-is: ShellTests.hs
237 htsn-common >= 0.0.1,
240 groundhog-postgresql >= 0.5,
241 groundhog-sqlite >= 0.5,
255 source-repository head
257 location: http://michael.orlitzky.com/git/htsn-import.git