From: Michael Orlitzky Date: Mon, 23 Jun 2014 19:49:44 +0000 (-0400) Subject: Add SportInfo support for MLB_Fielding_XML.dtd (overlooked somehow). X-Git-Tag: 0.0.6~74 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=3c937a49488d466ce38cccda3eabe2115a5238fe;p=dead%2Fhtsn-import.git Add SportInfo support for MLB_Fielding_XML.dtd (overlooked somehow). Create the list of SportInfo test cases from the DTD list. Remove one TODO and replace it with another about the missing SportInfo types. --- diff --git a/doc/TODO b/doc/TODO index 4d8ec9a..a27306c 100644 --- a/doc/TODO +++ b/doc/TODO @@ -16,4 +16,22 @@ 5. Update the list of schemagen files in htsn-import.cabal. -6. Derive the SportInfo test file paths from the DTD list when completed. +6. We have DTDs but no sample XML for the following SportInfo types, + which have therefore been left unimplmented for now: + + * Cbask_Indv_No_Avg_XML.dtd + * Cbask_Indv_Shooting_XML.dtd + * CBASK_StealsXML.dtd + * Cbask_Team_Scoring_Rebound_Margin_XML.dtd + * Cbask_Team_Scoring_XML.dtd + * Cbask_Team_Shooting_Pct_XML.dtd + * NFLGrassTurfDomeOutsideXML.dtd + * NFLInterceptionLeadersXML.dtd + * NFLPassingLeadersXML.dtd + * NFLReceivingLeadersXML.dtd + * NFLRushingLeadersXML.dtd + * NFLTackleFFLeadersXML.dtd + * NFLTopKickoffReturnXML.dtd + * NFLTopPuntReturnXML.dtd + * NFLYardsXML.dtd + * NFL_PuntingLeaders_XML.dtd diff --git a/doc/man1/htsn-import.1 b/doc/man1/htsn-import.1 index 826db40..6980942 100644 --- a/doc/man1/htsn-import.1 +++ b/doc/man1/htsn-import.1 @@ -77,6 +77,8 @@ cflpreviewxml.dtd .IP \[bu] Matchup_NBA_NHL_XML.dtd .IP \[bu] +MLB_Fielding_XML.dtd +.IP \[bu] MLB_Gaming_Matchup_XML.dtd .IP \[bu] MLB_Lineup_XML.dtd diff --git a/schema/MLB_Fielding_XML.dtd b/schema/MLB_Fielding_XML.dtd new file mode 100644 index 0000000..154e925 --- /dev/null +++ b/schema/MLB_Fielding_XML.dtd @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/schemagen/MLB_Fielding_XML/MLB_Fielding_XML.xml b/schemagen/MLB_Fielding_XML/MLB_Fielding_XML.xml new file mode 100644 index 0000000..8a57431 --- /dev/null +++ b/schemagen/MLB_Fielding_XML/MLB_Fielding_XML.xml @@ -0,0 +1,344 @@ + + + +82828217 +AAX%TEAM-FIELDING +Statistics +MLB +2002 MLB Team Statistics - Fielding + ++.986 +70 +1875 +767 +37 +2679 +64 +0 +3 + ++.985 +69 +1861 +780 +40 +2681 +78 +0 +11 + ++.985 +71 +1920 +660 +40 +2620 +56 +0 +2 + ++.984 +68 +1819 +720 +40 +2579 +61 +0 +9 + ++.984 +68 +1832 +666 +41 +2539 +66 +0 +3 + ++.983 +69 +1834 +755 +45 +2634 +69 +1 +8 + ++.982 +70 +1871 +709 +46 +2626 +57 +0 +3 + ++.982 +71 +1869 +730 +48 +2647 +73 +0 +3 + ++.981 +71 +1862 +727 +50 +2639 +73 +0 +7 + ++.981 +69 +1854 +673 +50 +2577 +76 +0 +4 + ++.980 +68 +1830 +691 +52 +2573 +50 +0 +3 + ++.979 +68 +1774 +703 +53 +2530 +65 +0 +4 + ++.979 +71 +1910 +661 +55 +2626 +45 +0 +3 + ++.978 +69 +1815 +748 +58 +2621 +54 +0 +14 + + + ++.988 +70 +1875 +659 +32 +2566 +51 +0 +8 + ++.987 +69 +1827 +715 +33 +2575 +90 +0 +5 + ++.986 +70 +1862 +685 +35 +2582 +55 +0 +3 + ++.986 +68 +1800 +720 +37 +2557 +66 +0 +6 + ++.985 +70 +1896 +695 +39 +2630 +73 +0 +0 + ++.984 +70 +1900 +758 +42 +2700 +63 +0 +5 + ++.983 +69 +1834 +724 +45 +2603 +71 +0 +2 + ++.982 +71 +1990 +829 +52 +2871 +84 +0 +4 + ++.982 +71 +1900 +749 +49 +2698 +59 +0 +6 + ++.982 +69 +1826 +646 +46 +2518 +57 +0 +4 + ++.981 +70 +1843 +838 +51 +2732 +69 +0 +4 + ++.981 +69 +1855 +737 +51 +2643 +65 +0 +4 + ++.980 +71 +1881 +732 +52 +2665 +77 +0 +5 + ++.979 +71 +1888 +739 +57 +2684 +65 +0 +3 + ++.978 +70 +1901 +800 +60 +2761 +62 +0 +5 + ++.977 +70 +1898 +705 +61 +2664 +64 +1 +5 + + + June 21, 2002, at 02:50 PM ET + diff --git a/src/TSN/XML/SportInfo.hs b/src/TSN/XML/SportInfo.hs index 289107d..7c5f1ac 100644 --- a/src/TSN/XML/SportInfo.hs +++ b/src/TSN/XML/SportInfo.hs @@ -25,6 +25,7 @@ where -- System imports. import Data.Either ( rights ) +import Data.String.Utils ( replace ) import Data.Time.Clock ( UTCTime ) import Database.Groundhog ( countAll, @@ -60,10 +61,6 @@ import Xml ( -- | The DTDs for everything that we consider \"Sport Info.\" -- --- TODO: This is the list from the old implementation. We need to --- make sure that we are really receiving XML for these DTDs --- (i.e. the names are correct). --- dtds :: [String] dtds = [ "CBASK_3PPctXML.dtd", @@ -78,17 +75,11 @@ dtds = "CBASK_FGPctXML.dtd", "CBASK_FoulsXML.dtd", "CBASK_FTPctXML.dtd", - "Cbask_Indv_No_Avg_XML.dtd", -- no xml "Cbask_Indv_Scoring_XML.dtd", - "Cbask_Indv_Shooting_XML.dtd", -- no xml "CBASK_MinutesXML.dtd", "Cbask_Polls_XML.dtd", "CBASK_ReboundsXML.dtd", "CBASK_ScoringLeadersXML.dtd", - "CBASK_StealsXML.dtd", -- no xml - "Cbask_Team_Scoring_Rebound_Margin_XML.dtd", -- no xml - "Cbask_Team_Scoring_XML.dtd", -- no xml - "Cbask_Team_Shooting_Pct_XML.dtd", -- no xml "Cbask_Team_ThreePT_Made_XML.dtd", "Cbask_Team_ThreePT_PCT_XML.dtd", "Cbask_Team_Win_Pct_XML.dtd", @@ -174,28 +165,18 @@ dtds = "nflfirstdownxml.dtd", "NFLFumbleLeaderXML.dtd", "NFLGiveTakeXML.dtd", - "NFLGrassTurfDomeOutsideXML.dtd", -- no xml "NFLInside20XML.dtd", - "NFLInterceptionLeadersXML.dtd", -- no xml "NFLKickoffsXML.dtd", "NFLMondayNightXML.dtd", - "NFLPassingLeadersXML.dtd", -- no xml "NFLPassLeadXML.dtd", "NFLQBStartsXML.dtd", - "NFLReceivingLeadersXML.dtd", -- no xml - "NFLRushingLeadersXML.dtd", -- no xml "NFLSackLeadersXML.dtd", "nflstandxml.dtd", - "NFLTackleFFLeadersXML.dtd", -- no xml "NFLTeamRankingsXML.dtd", - "NFLTopKickoffReturnXML.dtd", -- no xml "NFLTopPerformanceXML.dtd", - "NFLTopPuntReturnXML.dtd", -- no xml "NFLTotalYardageXML.dtd", - "NFLYardsXML.dtd", -- no xml "NFL_KickingLeaders_XML.dtd", "NFL_NBA_Draft_XML.dtd", - "NFL_PuntingLeaders_XML.dtd", -- no xml "NFL_Roster_XML.dtd", "NFL_Team_Stats_XML.dtd", "Transactions_XML.dtd", @@ -315,138 +296,10 @@ sport_info_tests = -- sport_info_test_files :: [FilePath] sport_info_test_files = - map ("test/xml/sportinfo/" ++) [ - "CBASK_3PPctXML.xml", - "Cbask_All_Tourn_Teams_XML.xml", - "CBASK_AssistsXML.xml", - "Cbask_Awards_XML.xml", - "CBASK_BlocksXML.xml", - "Cbask_Conf_Standings_XML.xml", - "Cbask_DivII_III_Indv_Stats_XML.xml", - "Cbask_DivII_Team_Stats_XML.xml", - "Cbask_DivIII_Team_Stats_XML.xml", - "CBASK_FGPctXML.xml", - "CBASK_FoulsXML.xml", - "CBASK_FTPctXML.xml", - "Cbask_Indv_Scoring_XML.xml", - "CBASK_MinutesXML.xml", - "Cbask_Polls_XML.xml", - "CBASK_ReboundsXML.xml", - "CBASK_ScoringLeadersXML.xml", - "Cbask_Team_ThreePT_Made_XML.xml", - "Cbask_Team_ThreePT_PCT_XML.xml", - "Cbask_Team_Win_Pct_XML.xml", - "Cbask_Top_Twenty_Five_XML.xml", - "CBASK_TopTwentyFiveResult_XML.xml", - "Cbask_Tourn_Awards_XML.xml", - "Cbask_Tourn_Champs_XML.xml", - "Cbask_Tourn_Indiv_XML.xml", - "Cbask_Tourn_Leaders_XML.xml", - "Cbask_Tourn_MVP_XML.xml", - "Cbask_Tourn_Records_XML.xml", - "LeagueScheduleXML.xml", - "minorscoresxml.xml", - "Minor_Baseball_League_Leaders_XML.xml", - "Minor_Baseball_Standings_XML.xml", - "Minor_Baseball_Transactions_XML.xml", - "mlbbattingavgxml.xml", - "mlbdoublesleadersxml.xml", - "MLBGamesPlayedXML.xml", - "MLBGIDPXML.xml", - "MLBHitByPitchXML.xml", - "mlbhitsleadersxml.xml", - "mlbhomerunsxml.xml", - "MLBHRFreqXML.xml", - "MLBIntWalksXML.xml", - "MLBKORateXML.xml", - "mlbonbasepctxml.xml", - "MLBOPSXML.xml", - "MLBPlateAppsXML.xml", - "mlbrbisxml.xml", - "mlbrunsleadersxml.xml", - "MLBSacFliesXML.xml", - "MLBSacrificesXML.xml", - "MLBSBSuccessXML.xml", - "mlbsluggingpctxml.xml", - "mlbstandxml.xml", - "mlbstandxml_preseason.xml", - "mlbstolenbasexml.xml", - "mlbtotalbasesleadersxml.xml", - "mlbtriplesleadersxml.xml", - "MLBWalkRateXML.xml", - "mlbwalksleadersxml.xml", - "MLBXtraBaseHitsXML.xml", - "MLB_ERA_Leaders.xml", - "MLB_Pitching_Appearances_Leaders.xml", - "MLB_Pitching_Balks_Leaders.xml", - "MLB_Pitching_CG_Leaders.xml", - "MLB_Pitching_ER_Allowed_Leaders.xml", - "MLB_Pitching_Hits_Allowed_Leaders.xml", - "MLB_Pitching_Hit_Batters_Leaders.xml", - "MLB_Pitching_HR_Allowed_Leaders.xml", - "MLB_Pitching_IP_Leaders.xml", - "MLB_Pitching_Runs_Allowed_Leaders.xml", - "MLB_Pitching_Saves_Leaders.xml", - "MLB_Pitching_Shut_Outs_Leaders.xml", - "MLB_Pitching_Starts_Leaders.xml", - "MLB_Pitching_Strike_Outs_Leaders.xml", - "MLB_Pitching_Walks_Leaders.xml", - "MLB_Pitching_WHIP_Leaders.xml", - "MLB_Pitching_Wild_Pitches_Leaders.xml", - "MLB_Pitching_Win_Percentage_Leaders.xml", - "MLB_Pitching_WL_Leaders.xml", - "NBA_Team_Stats_XML.xml", - "NBA3PPctXML.xml", - "NBAAssistsXML.xml", - "NBABlocksXML.xml", - "nbaconfrecxml.xml", - "nbadaysxml.xml", - "nbadivisionsxml.xml", - "NBAFGPctXML.xml", - "NBAFoulsXML.xml", - "NBAFTPctXML.xml", - "NBAMinutesXML.xml", - "NBAReboundsXML.xml", - "NBAScorersXML.xml", - "nbastandxml.xml", - "NBAStealsXML.xml", - "nbateamleadersxml.xml", - "nbatripledoublexml.xml", - "NBATurnoversXML.xml", - "NCAA_Conference_Schedule_XML.xml", - "nflfirstdownxml.xml", - "NFLFumbleLeaderXML.xml", - "NFLGiveTakeXML.xml", - "NFLInside20XML.xml", - "NFLKickoffsXML.xml", - "NFLMondayNightXML.xml", - "NFLPassLeadXML.xml", - "NFLQBStartsXML.xml", - "NFLSackLeadersXML.xml", - "nflstandxml.xml", - "NFLTeamRankingsXML.xml", - "NFLTopPerformanceXML.xml", - "NFLTotalYardageXML.xml", - "NFL_KickingLeaders_XML.xml", - "NFL_NBA_Draft_XML.xml", - "NFL_Roster_XML.xml", - "NFL_Team_Stats_XML.xml", - "Transactions_XML.xml", - "Weekly_Sched_XML.xml", - "WNBA_Team_Leaders_XML.xml", - "WNBA3PPctXML.xml", - "WNBAAssistsXML.xml", - "WNBABlocksXML.xml", - "WNBAFGPctXML.xml", - "WNBAFoulsXML.xml", - "WNBAFTPctXML.xml", - "WNBAMinutesXML.xml", - "WNBAReboundsXML.xml", - "WNBAScorersXML.xml", - "wnbastandxml.xml", - "WNBAStealsXML.xml", - "WNBATurnoversXML.xml" ] - + map (change_suffix . add_path) dtds + where + add_path = ("test/xml/sportinfo/" ++ ) + change_suffix = replace ".dtd" ".xml" -- | Make sure we can parse every element of 'sport_info_test_files'. diff --git a/test/xml/sportinfo/MLB_Fielding_XML.dtd b/test/xml/sportinfo/MLB_Fielding_XML.dtd new file mode 100644 index 0000000..154e925 --- /dev/null +++ b/test/xml/sportinfo/MLB_Fielding_XML.dtd @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/xml/sportinfo/MLB_Fielding_XML.xml b/test/xml/sportinfo/MLB_Fielding_XML.xml new file mode 100644 index 0000000..8a57431 --- /dev/null +++ b/test/xml/sportinfo/MLB_Fielding_XML.xml @@ -0,0 +1,344 @@ + + + +82828217 +AAX%TEAM-FIELDING +Statistics +MLB +2002 MLB Team Statistics - Fielding + ++.986 +70 +1875 +767 +37 +2679 +64 +0 +3 + ++.985 +69 +1861 +780 +40 +2681 +78 +0 +11 + ++.985 +71 +1920 +660 +40 +2620 +56 +0 +2 + ++.984 +68 +1819 +720 +40 +2579 +61 +0 +9 + ++.984 +68 +1832 +666 +41 +2539 +66 +0 +3 + ++.983 +69 +1834 +755 +45 +2634 +69 +1 +8 + ++.982 +70 +1871 +709 +46 +2626 +57 +0 +3 + ++.982 +71 +1869 +730 +48 +2647 +73 +0 +3 + ++.981 +71 +1862 +727 +50 +2639 +73 +0 +7 + ++.981 +69 +1854 +673 +50 +2577 +76 +0 +4 + ++.980 +68 +1830 +691 +52 +2573 +50 +0 +3 + ++.979 +68 +1774 +703 +53 +2530 +65 +0 +4 + ++.979 +71 +1910 +661 +55 +2626 +45 +0 +3 + ++.978 +69 +1815 +748 +58 +2621 +54 +0 +14 + + + ++.988 +70 +1875 +659 +32 +2566 +51 +0 +8 + ++.987 +69 +1827 +715 +33 +2575 +90 +0 +5 + ++.986 +70 +1862 +685 +35 +2582 +55 +0 +3 + ++.986 +68 +1800 +720 +37 +2557 +66 +0 +6 + ++.985 +70 +1896 +695 +39 +2630 +73 +0 +0 + ++.984 +70 +1900 +758 +42 +2700 +63 +0 +5 + ++.983 +69 +1834 +724 +45 +2603 +71 +0 +2 + ++.982 +71 +1990 +829 +52 +2871 +84 +0 +4 + ++.982 +71 +1900 +749 +49 +2698 +59 +0 +6 + ++.982 +69 +1826 +646 +46 +2518 +57 +0 +4 + ++.981 +70 +1843 +838 +51 +2732 +69 +0 +4 + ++.981 +69 +1855 +737 +51 +2643 +65 +0 +4 + ++.980 +71 +1881 +732 +52 +2665 +77 +0 +5 + ++.979 +71 +1888 +739 +57 +2684 +65 +0 +3 + ++.978 +70 +1901 +800 +60 +2761 +62 +0 +5 + ++.977 +70 +1898 +705 +61 +2664 +64 +1 +5 + + + June 21, 2002, at 02:50 PM ET +