For serializing
a Java object into XML, you can use an open source Java library called
XStream. For using this library you have to download and install it
and then use the following import statement in your Java code.
_______________________________________________
_______________________________________________
import
com.thoughtworks.xstream.XStream;
Once you
have included this class in your code, you can create an XStream object
and then use that object to serialize any class you want. To create
an xstream object you will be writing code like,
XStream
xstrm = new XStream();
Suppose
you have a class called 'car' with the member variables like 'model'
and 'make' which is written as given below.
class car
{
string model;
string make;
}
You can
serialize this class using the following code,
String
xml = xstrm.toXML(car);
Now use
a print statement to print the values of the string xml. You can also
deserialize the XML to Java objects. Sample code for these conversions
is available in the internet.
Google releases serialization scheme (The Register)
Pedantic programmers hold love-in Fail and You Protocol buffer : it's the object serialization scheme the pretentious little shit on your development team has been talking at you about during lunch hours for the past couple of days. You've been feigning interest with a steady stream of "oh-yeahs" and "that-sounds-cools", so you don't really know what it is.…