@Test public void objectToXml()throws Exception { JaxbSample.objectToXml(); }
public static void objectToXml() throws Exception { User user = getUser(); JAXBContext context = JAXBContext.newInstance(User.class); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); FileWriter writer = new FileWriter("out/JaxbSample.xml"); m.marshal(user, writer); }
JaxbSample { public static void objectToXml() throws Exception { User user = getUser(); JAXBContext context = JAXBContext.newInstance(User.class); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); FileWriter writer = new FileWriter("out/JaxbSample.xml"); m.marshal(user, writer); } }
JaxbSample { public static void objectToXml() throws Exception { User user = getUser(); JAXBContext context = JAXBContext.newInstance(User.class); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); FileWriter writer = new FileWriter("out/JaxbSample.xml"); m.marshal(user, writer); }  }
JaxbSample { public static void objectToXml() throws Exception { User user = getUser(); JAXBContext context = JAXBContext.newInstance(User.class); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); FileWriter writer = new FileWriter("out/JaxbSample.xml"); m.marshal(user, writer); }  static User getUser(); static void objectToXml(); static User xmlToObject(); static void main(String args[]); }
JaxbSample { public static void objectToXml() throws Exception { User user = getUser(); JAXBContext context = JAXBContext.newInstance(User.class); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); FileWriter writer = new FileWriter("out/JaxbSample.xml"); m.marshal(user, writer); }  static User getUser(); static void objectToXml(); static User xmlToObject(); static void main(String args[]);  }