I have a homework assignment asking to generate an XML document which displays results from a database holding results from Lacrosse games.
(the actual requirement in the assignment is as follows: "
The root element is obviously the lacrosse tag. Within the document there are a list of team elements that represent individual teams. For each team there are the total number of wins and losses and a list of opponent elements that contain the name of the opponent team, whether their game was played at home (the team’s field) or away (the opponents field), the number of goals the team scored (for) and the number of goals the opponent scored (against). Do all of your database connecting and accesses through a java class. Then use the class to isolate the JDBC calls away from the XML building. I have set up a database and table with the following parameters for access and query.")
The database results table structure is provided as:
Column Data __Type
game_id______Integer
home_team___String
away_team___String
home_score___Integer
away_score___Integer
game_note____String
The XML document should be displayed as:
<lacrosse>
<title>College Lacrosse Results</title>
_<team>
____team_name
____<wins>number of wins</wins>
____<losses>number of losses</losses>
____<opponent>
_________opponent_name
_________<location>home or away</location>
_________<for>goals scored</for>
_________<against>goals given up</against>
____</opponent>
____<opponent>
____:
____</opponent>
____:
_</team>
_<team>
_:
_</team>
</lacrosse>
Part of the assignment notes to "Be sure to handle the overall win-loss record and home/away designations of the games correctly. They are not
explicitly handled in the database table, you will have to compute those values based on the data record itself (i.e.,
whether the team name is indicated in the home or away team column)."
I'm hoping someone can give me some guidance for the logic of the last paragraph here, which is bolded above. I haven't gotten to coding yet - still looking at the design. OF course, I don't want the specific answer, but just some pointers in the right direction would be appreciated. Thanks.