Package

Source Code of Object2XMLEx

import org.vietspider.parser.xml.XMLDocument;
import org.vietspider.serialize.Bean2XML;
import org.vietspider.serialize.XML2Bean;

/***************************************************************************
* Copyright 2001-2008 The VietSpider         All rights reserved.       *
**************************************************************************/

/**
* Author : Nhu Dinh Thuan
*          nhudinhthuan@yahoo.com
* Jul 26, 2008 
*/
public class Object2XMLEx {
 
  public static void main(String[] args) throws Exception {
    Student student = new Student("123", "Nguyen Van A");
   
    Bean2XML bean2XML = Bean2XML.getInstance();
    XMLDocument document = bean2XML.toXMLDocument(student);
   
    String text = document.getTextValue();
    System.out.println(text);
   
   
    XML2Bean xml2Bean = XML2Bean.getInstance();
    Student student2 = xml2Bean.toBean(Student.class, text);
   
    System.out.println("\nstudent 2 name: " +student2.getName());
   
  }
 
 
}
TOP

Related Classes of Object2XMLEx

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.