Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

writing java objects to xml

 
Hari priya
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi -
I am trying to write the java objects to an xml file, with the objects' member field as the xml tags.
Can some one let me know ways to achieve this?
Thanks in advance,
Radha
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look for examples on things like Castor...which can map
java objects to XML strings.
I don't have any links off the top of my head.
Hopefully others maybe able to provide better examples/links...
regds.
- m
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could also check out the source code for XStream, which is probably the simplest Java-to-XML serializer library I'm aware of.
 
Vijayanandraj Amaladoss
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use castor , Simple , Easy and Stable. U can get lots of example and references . Moreover it provides a source code generator which generates java classes for the schema you give.
http://www.castor.org/
 
Hari priya
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi -
Thank you all guys for your replies. I have looked into castor and xstreme and am trying to work in those lines.
Radha
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic