Package com.epam

Source Code of com.epam.TestJAXB

package com.epam;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;

import schemafiles.ObjectFactory;
import schemafiles.Shiporder;
import schemafiles.Shiporder.Shipto;

public class TestJAXB
{
     private ObjectFactory objectFactory;
     private Shiporder shipOrder;
    
     public TestJAXB()
     {
       this.objectFactory = new ObjectFactory();
       this.shipOrder = this.objectFactory.createShiporder();
     }
    
     public void make()
     {
       this.shipOrder.setOrderperson("Fedor");
      
       Shipto shipto = this.objectFactory.createShiporderShipto();
       shipto.setCity("Minsk");
       shipto.setCountry("Belarus");
       shipto.setName("Misha");
      
       this.shipOrder.setShipto(shipto);
     }
    
     public void marshall() throws Exception
     {
       JAXBContext context = JAXBContext.newInstance("schemafiles");
       Marshaller marsh = context.createMarshaller();
       marsh.marshal(shipOrder, System.out);
     }
}
TOP

Related Classes of com.epam.TestJAXB

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.