• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Objects to XML  RSS feed

 
Yohan Liyanage
Ranch Hand
Posts: 132
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to serialize a Java object to an XML file and distribute it through a web service?
 
Masoud Kalali
Author
Ranch Hand
Posts: 531
Java Mac OS X Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Yohan,
You can use Xstream located in http://xstream.codehaus.org/ or any other object to xml serializer like JAXB,JBIX,...

But can i ask why you want to serialize an object yourself?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the object class follows the JavaBean conventions you can serialize it to XML using the java.beans.XMLEncoder class (since java 1.4).

Note that some Java objects cannot be serialized by any method because of specific information specific to the operating system and/or current JVM.

Bill
 
Yohan Liyanage
Ranch Hand
Posts: 132
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Masoud, Bill. I just wanted to know if there is a possibility. I am considering different approaches for a distributed application framework.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!