
Serialize and deserialize Java objects to and from XMLA 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
{ 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.
Tuning and Testing Enterprise Web Services with SoapUI and JMeter (Developer.com) Where the Wild Things Are: an Adventure in Silverlight (Act I) (O'Reilly Media)
|
Cisco
CCNA Certification Video Tutorial Guide - Learn How to Pass the Cisco
CCNA 640-802 Exam... Guaranteed!
| |||
|
| ||||