<?xml version = "1.0" encoding = "utf-8"?> <!ELEMENT report (date, sportname, game+)> <!ELEMENT date (#PCDATA)> <!ELEMENT sportname (#PCDATA)>
<!ELEMENT game (winner, loser, score)> <!ELEMENT winner (#PCDATA)> <!ELEMENT loser (#PCDATA)> <!ELEMENT score (#PCDATA)>
<?xml version = "1.0" encoding = "utf-8"?> <!DOCTYPE sports SYSTEM "sports.dtd"> <sports> <date>2016 November</date> <sportname>Baseball</sportName> <game> <winner>Cubs</winner> <loser>Indians</loser> <score>8 - 7</score> </game>
<game> <winner></winner> <loser></loser> <score></score> </game> </sports>
Returns the winner, loser, and score for a specfic game http://my-sport.com/sportsReport/GetGameInfo?
Returns the date for the report http://my-sport.com/sportsReport/GetReportDate?
Returns the sportsname for the report http://my-sport.com/sportsReport/GetSportsName?
<!DOCTYPE sports [ <!ELEMENT sports (date, sportname, sequenceofgames+)> <!ELEMENT date (#PCDATA)> <!ELEMENT sportname (#PCDATA)>
<!ELEMENT sequenceofgames(winningteam, losingteam, score)> <!ELEMENT winningteam (#PCDATA)> <!ELEMENT losingteam (#PCDATA)> <!ELEMENT score (#PCDATA)> ]>
<?xml version="1.0"?> <!DOCTYPE sports SYSTEM "sports.dtd"> <sports> <date> 11/16/2016 </date> <sportname> Soccer </sportname> <sequenceofgames> <winningteam>France</winningteam> <losingteam>Spain</losingteam> <score>1-0</score> </sequenceofgames> </sports>
<?xml version = "1.0" encoding = "utf-8" ?> <!ELEMENT sports(date, sportName, game+) >
<!ELEMENT date (#PCDATA)> <!ELEMENT sportName (#PCDATA)> <!ELEMENT game (#PCDATA)>
<!ATTLIST game winning CDATA #REQUIRED> <!ATTLIST game losing CDATA #REQUIRED> <!ATTLIST game score (team1|team2) CDATA #REQUIRED>
<?xml version = "1.0" encoding = "UTF-8"?> <!DOCTYPE sports SYSTEM "sports.dtd"> <sports> <date>11/16/16 </date> <sportName>Football </sportName> <game winning = "49ers" losing = "Packers" score = "14 2">GAME1 </game> <game winning = "Patriots" losing = "Bears" score = "7 2">GAME2 </game> <game winning = "Seahawks" losing = "Raiders" score = "21 14">GAME3 </game> </sports>
http://my-sport.com/sportAPI/date=11-16-16&game=GAME1 http://my-sport.com/sportAPI/date=11-16-16&game=GAME2 http://my-sport.com/sportAPI/date=11-16-16&game=GAME3
<?xml version="1.0"?> <!DOCTYPE sport [ <!ELEMENT sport (date, sportname, sequenceOfGames)> <!ELEMENT date (#PCDATA)> <!ELEMENT sportname (#PCDATA)> <!ELEMENT sequenceOfGames (game*)> <!ELEMENT game (winningTeam, losingTeam, score) <!ATTLIST game id CDATA #REQUIRED><!ELEMENT winningTeam (#PCDATA)> <!ELEMENT losingTeam (#PCDATA)> <!ELEMENT score (#PCDATA) ]> XML DOCUMENT: <sport>
<date></date> <sportname></sportname> <sequenceOfGame> <game id="01"> <winningTeam></winningTeam> <losingTeam></losingTeam> <score></score> </game> <game id="02"> <winningTeam></winningTeam> <losingTeam></losingTeam> <score></score> </game> </sequenceOfGame></sport>
<?xml version="1.0" encoding="UTF-8"?> <!ELEMENT Report (Sports)+> <!ELEMENT Sports Winning_team,Losing_team,Score> <!ATTLIST Sports date CDATA #REQUIRED> <!ATTLIST Sports name CDATA #REQUIRED> <!ELEMENT Winning_team (#PCDATA)> <!ELEMENT Losing_team (#PCDATA)> <!ELEMENT Score (#PCDATA)>
<Report> <Sports name="Hockey" date="11/16/2016"> <Winning_team>Sharks</Winning_team> <Losing_team></Losing_team> <Score>214</Score> </Sports>
<Sports name="Baseball" date="11/12/2016"> <Winning_team>Cubs</Winning_team> <Losing_team>Indians</Losing_team> <Score>123</Score> </Sports></Report>
REST: http://my-sport.com/sport/get_winner?name=Baseball&date=11/12/2016 This fetches the winner when the sport name and date of game is passed as argument
<!DOCTYPE sports SYSTEM "sports.dtd"> <sports> <date>14 Nov 2016</date> <name>Basketball</name> <game> <winning_team>India</winning_team> <losing_team>India</losing_team> <score>8</score> </game> <game> <winning_team>India</winning_team> <losing_team>India</losing_team> <score>6</score> </game> </sports>
<!DOCTYPE sports [ <!ELEMENT sports (date, name, sequenceofgames)> <!ELEMENT date (#PCDATA)> <!ELEMENT name (#PCDATA)> <!ELEMENT sequenceofgames(winning_team, losing_team, score)> <!ELEMENT winning_team (#PCDATA)> <!ELEMENT losing_team (#PCDATA)> <!ELEMENT score (#PCDATA)> ]>
<?xml version = "1.0" encoding = "utf-8"?> <!ELEMENT report (date, sport, games)> <!ELEMENT date (#PCDATA)> <!ELEMENT sport (#PCDATA)> <!ELEMENT games (game+)> <!ELEMENT game (winner, loser, score)> <!ELEMENT winner (#PCDATA)> <!ELEMENT loser (#PCDATA)> <!ELEMENT score (#PCDATA)> <report> <date>9/10/2011</date> <sport>Hockey</sport> <games> <game> <winner>Sharks</winner> <loser>Kings</loser> <score>3-0</score> </game> </games></report> Get report for Hockey http://my-sport.com/report/get_report?name=hockey Get games from a report (Hockey report 9/10/2011 in this case) http://my-sport.com/report/get_games?name=hockey&date=9/10/2011 Add game to a report (adding to Hockey report 9/10/2011 in this case) http://my-sport.com/report/add_game?name=hockey&date=9/10/2011&winner=Sharks&loser=Kings&score=3-1
DTD <?xml version = "1.0" encoding = "utf-8" ?> <!ELEMENT report(date, name, game) > <!ELEMENT date(#PCDATA) > <!ELEMENT name(#PCDATA) > <!ELEMENT game(win, lose, score) > <!ELEMENT win(#PCDATA) > <!ELEMENT lose(#PCDATA) > <!ELEMENT score(#PCDATA) >
XML <?xml version="1.0"?> <!DOCTYPE sports SYSTEM "sports.dtd"> <sports> <report> <date>11-15-16</date> <name>Hockey</name> <game> <win>Hurricanes</win> <lose>Sharks</lose> <score>0-1</score> </game> </report> </sports>
Rest API Returns report given date and name http://my-sport.com/report/get_report?date=11-15-16&name=Hockey
Returns game given report date and name http://my-sport.com/game/get_game?date=11-15-16&name=Hockey
Returns score given report date and name http://my-sport.com/score/get_score?date=11-15-16&name=Hockey
loser CDATA #REQUIRED score CDATA #REQUIRED>