• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

read in a xml file

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone,
I would like to have a Java servlet that reads an XML file, determines the format of the data, creates a table in SQL Server 7.0 to accept the file and loads the file into the SQL Server table.
Please tell me if this is feasible. If so, would give me some basic instructions on coding it?
Greatly appreciate your help.
Michael
 
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, it is feasable.
Use an XML parser (I recomment Xerces www.apache.org) to parse your xml file. I prefer using SAX parsers over DOM, but that is mostly a personal preference. Put some data type cues in your xml so that you can quickly determine the data format (such as a data type tag or something).
Use your content handler or read your DOM tree to create your SQL table.
Java and XML is a really good book on the subject from Oreilly.
Good luck.
 
Michael.H.Sun
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chris,
Thank you for the instructions. I will try what you said. If I have more questions, I may paste them again.
Michael
 
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use Jdom is a lot easier. www.jdom.org
 
Michael.H.Sun
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you, Roseanne. I will try JCOM.
Michael
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic