Created
July 13, 2013 00:03
XStream - One of the best Java and XML Framework around - http://codeoftheday.blogspot.com/2013/07/xstream-one-of-best-java-and-xml.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* XStream - One of the best Java and XML Framework around | |
* http://codeoftheday.blogspot.com/2013/07/xstream-one-of-best-java-and-xml.html | |
*/ | |
package smhumayun.codeoftheday.XStreamExample; | |
import com.thoughtworks.xstream.XStream; | |
import java.util.Date; | |
/** | |
* Main Example class | |
* | |
* User: smhumayun | |
* Date: 7/12/13 | |
* Time: 7:53 PM | |
*/ | |
public class MainXStreamExample { | |
public static void main(String[] args) { | |
//Instantiate XStream | |
XStream xstream = new XStream(); | |
//Instantiate and initialize any domain object of yours | |
User user = new User(1, "Syed Muhammad Humayun", new Date(System.currentTimeMillis())); | |
//Convert your domain object to XML instantly with a single statement call! | |
System.out.println(xstream.toXML(user)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment