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
18 schemagen/Heartbeat/*.xml
19 schemagen/injuriesxml/*.xml
20 schemagen/Injuries_Detail_XML/*.xml
21 schemagen/newsxml/*.xml
22 schemagen/Odds_XML/*.xml
23 schemagen/weatherxml/*.xml
25 Import XML files from The Sports Network into an RDBMS.
30 htsn-import [OPTIONS] [FILES]
33 The Sports Network <http://www.sportsnetwork.com/> offers an XML feed
34 containing various sports news and statistics. Our sister program
35 /htsn/ is capable of retrieving the feed and saving the individual
36 XML documents contained therein. But what to do with them?
38 The purpose of /htsn-import/ is to take these XML documents and
39 get them into something we can use, a relational database management
40 system (RDBMS), loosely known as a SQL database. The structure of
41 relational database, is, well, relational, and the feed XML is not. So
42 there is some work to do before the data can be inserted.
44 First, we must parse the XML. Each supported document type (see below)
45 has a full pickle/unpickle implementation (\"pickle\" is simply a
46 synonym for serialize here). That means that we parse the entire
47 document into a data structure, and if we pickle (serialize) that data
48 structure, we get the exact same XML document tha we started with.
50 This is important for two reasons. First, it serves as a second level
51 of validation. The first validation is performed by the XML parser,
52 but if that succeeds and unpicking fails, we know that something is
53 fishy. Second, we don't ever want to be surprised by some new element
54 or attribute showing up in the XML. The fact that we can unpickle the
55 whole thing now means that we won't be surprised in the future.
57 The aforementioned feature is especially important because we
58 automatically migrate the database schema every time we import a
59 document. If you attempt to import a \"newsxml.dtd\" document, all
60 database objects relating to the news will be created if they do not
61 exist. We don't want the schema to change out from under us without
62 warning, so it's important that no XML be parsed that would result in
63 a different schema than we had previously. Since we can
64 pickle/unpickle everything already, this should be impossible.
66 Examples and usage documentation are available in the man page.
68 executable htsn-import
72 configurator == 0.2.*,
79 groundhog-postgresql == 0.4.*,
80 groundhog-sqlite == 0.4.*,
81 groundhog-th == 0.4.*,
87 transformers == 0.3.*,
102 OptionalConfiguration
109 TSN.XML.InjuriesDetail
118 -fwarn-missing-signatures
119 -fwarn-name-shadowing
123 -fwarn-incomplete-record-updates
124 -fwarn-monomorphism-restriction
125 -fwarn-unused-do-bind
136 -- The following unbreak profiling with template haskell. We have
137 -- to build the program twice; once without profile and again with
144 type: exitcode-stdio-1.0
145 hs-source-dirs: src test
146 main-is: TestSuite.hs
150 configurator == 0.2.*,
154 htsn-common == 0.0.1,
157 groundhog-postgresql == 0.4.*,
158 groundhog-sqlite == 0.4.*,
159 groundhog-th == 0.4.*,
163 tasty-hunit == 0.4.*,
165 transformers == 0.3.*,
168 -- It's not entirely clear to me why I have to reproduce all of this.
172 -fwarn-missing-signatures
173 -fwarn-name-shadowing
177 -fwarn-incomplete-record-updates
178 -fwarn-monomorphism-restriction
179 -fwarn-unused-do-bind
188 type: exitcode-stdio-1.0
193 -- Additional test dependencies.
196 -- It's not entirely clear to me why I have to reproduce all of this.
200 -fwarn-missing-signatures
201 -fwarn-name-shadowing
205 -fwarn-incomplete-record-updates
206 -fwarn-monomorphism-restriction
207 -fwarn-unused-do-bind
215 source-repository head
217 location: http://michael.orlitzky.com/git/htsn-import.git