Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Generating an xml file

 
ramjcp kris
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

I have a scenario in which i need to post the data in to database as well as i should be able to generate an xml file of this data which other interfaces would use.
can any one suggest me how i can write the data into xml file.
or please suggest me any useful links regarding this.

Thanks and waiting for reply with anticipation
 
Daniel Rhoades
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your looking for a common way to write data to different types of datasources consider the DAO pattern. If your using EJB's then your server vendor might let you create a JNDI datasource mapping.
 
Eddy Lee Sin Ti
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depends on your original data structure. If the source structure is in a result set, you might utilize the facility provided in javax.sql.rowset.WebRowSet to persist it to xml output.

If arbitrary structure such as POJO is used as source, then you can utilize JAXP API to do the serialization yourself.

And yes, using pattern such as DAO is useful in encapsulating the persistence strategy above so that you can change it without major impact.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic