• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

a bit of help needed for an XML/JDBC assignment

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
author
Posts: 4335
39
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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"
 
Dieter Stryker
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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...?
reply
    Bookmark Topic Watch Topic
  • New Topic