Serialize and deserialize Java objects to and from XML

A unique open source Java library called XStream is available for serializing and deserializing Java objects to and from XML. A small team of developers contribute to the development of the XStream Java library.

_______________________________________________


_______________________________________________

To use this library you have to use the following import statement,

import com.thoughtworks.xstream.XStream;

Once you have this import statement you can create the XStream object using the statement like,

XStream xs = new XStream();

Let us suppose you have a class called 'person' with member variables like 'name' and 'location', which is defined as below,

class person {
string name;
string location;
}

The above class can be serialized using the XStream object as given below,

String xml = xs.toXML(person);

Now you can print the string xml using the print statement. Assuming that you have set the values of the member variables within the program, you would get an XML output with the string values set as the text values of the elements 'name' and 'location'. The output would also include the <xml version="1.0"?> line as the first line in the XML document.

Thus by using XStream you can serialize or deserialize Java objects to XML and from XML. Lot of examples using the XStream library is available in the internet.

Sony Simplifies Blu-Ray Disc Authoring (BIOS)
Sony Creative Software has put the finishing touches to some upgrades to its DVD Architect and Bluprint applications for authoring Blu-ray discs. DVD Architect 5 software enables independent producers and videographers to author both a standard definition DVD or...

eValid Supports Regular Expressions Analysis of Web Pages (PRWeb via Yahoo! News)
Functional testing of web applications now has a new degree of generality with the introduction of Regular Expression processing in the eValid suite.



FREE Subscription

Subscribe to our mailing list and receive new articles
through email. Keep yourself updated with latest
developments in the industry.

Name:
Email:

Note : We never rent, trade, or sell my email lists to
anyone. We assure that your privacy is respected
and protected.

_______________________________________

Recommended XML Books

cover
cover
cover
cover
cover
cover






 

 

FREE Subscription

Stay Current With the Latest Technology Developments Realted to XML. Signup for Our Newsletter and Receive New Articles Through Email.

Name:

Email:

Note : We never rent, trade, or sell our email lists to anyone. We assure that your privacy is respected and protected.

 

 

Add to My Yahoo!


New XML Books Titles - Best Seller's @ Amazon.com

Visit XML Training Material Guide Homepage

Technology helps engage students - how do classroom instruction and social dynamics change when the classroom is completely dependant on modern technology?

Dallas Web Design- local Dallas web design firm offers site design and backend system development