(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
The XML document should be displayed as:
<title>College Lacrosse Results</title>
____<wins>number of wins</wins>
____<losses>number of losses</losses>
_________<location>home or away</location>
_________<against>goals given up</against>
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.
Scott Selikoff wrote:The ending paragraph sounds to me like "Get all the data via JDBC, but do the log/processing in pure Java". It basically means the database isn't a magic place with all the answers, some have to be done by hand. I don't know if that exactly holds true in this assignment though since... there's always 'some' way to do it via the DB, even if its a bad idea. Granted most teachers wouldn't know a bad query if it stood up and waved, so as with most student assignments "If it compiles, it must work"
I'm still not seeing exactly how this process should be performed.
Can anyone help me with the logic of extracting the MySQL data, what type of object to store it in, and whether I should use DOM or SAX (it has to be one of these) to create the XML document...?