List of usage examples for javax.xml.bind Marshaller JAXB_FORMATTED_OUTPUT
String JAXB_FORMATTED_OUTPUT
To view the source code for javax.xml.bind Marshaller JAXB_FORMATTED_OUTPUT.
Click Source Link
From source file:Main.java
public static void main(String[] args) throws Exception { JAXBContext jc = JAXBContext.newInstance(A.class, B.class); Marshaller marshaller = jc.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); A a = new A(); a.setFoo("Hello World"); marshaller.marshal(a, System.out); B b = new B(); b.setFoo("Hello World"); marshaller.marshal(b, System.out); }
From source file:Main.java
public static void main(String[] args) throws Exception { JAXBContext jc = JAXBContext.newInstance(Field.class); Marshaller marshaller = jc.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); Field field = new Field(); field.name = "myField"; marshaller.marshal(field, System.out); field.status = "citizen"; field.country = "England"; marshaller.marshal(field, System.out); field.status = null;/*from w w w . j a v a 2 s.c om*/ marshaller.marshal(field, System.out); }
From source file:Main.java
public static void main(String[] args) throws Exception { JAXBContext jc = JAXBContext.newInstance(BarX.class, BarY.class); Marshaller marshaller = jc.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); BarX barX = new BarX(); barX.setXThing("XThing"); marshaller.marshal(barX, System.out); BarY barY = new BarY(); barY.setYBlah("YBlah"); marshaller.marshal(barY, System.out); }
From source file:Main.java
public static void main(String[] args) throws JAXBException { JAXBContext context = JAXBContext.newInstance(Vehicals.class); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); Vehicals vehicals = new Vehicals(); List<Car> cars = new ArrayList<Car>(); Car c = new Car(); c.setName("Mercedes"); cars.add(c);/*from www . j a va 2 s . c o m*/ c = new Car(); c.setName("BMW"); cars.add(c); vehicals.setCar(cars); m.marshal(vehicals, System.out); }
From source file:Main.java
public static void main(String[] args) throws Exception { JAXBContext jc = JAXBContext.newInstance(Bar.class); Bar bar = new Bar(); bar.setAtt1("a"); bar.setAtt2("b"); Marshaller marshaller = jc.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); marshaller.marshal(bar, System.out); }
From source file:Main.java
public static void main(String[] args) throws Exception { JAXBContext jc = JAXBContext.newInstance(Parent.class, IntegerChild.class, StringChild.class); Marshaller marshaller = jc.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); IntegerChild integerChild = new IntegerChild(); integerChild.getItem().add(1);/*w ww. java 2 s . co m*/ integerChild.getItem().add(2); marshaller.marshal(integerChild, System.out); StringChild stringChild = new StringChild(); stringChild.getItem().add("A"); stringChild.getItem().add("B"); marshaller.marshal(stringChild, System.out); }
From source file:Main.java
public static void main(String[] args) throws Exception { JAXBContext jc = JAXBContext.newInstance(Child.class); Child child = new Child(); child.setParentProp("parent-value"); child.setChildProp("child-value"); Marshaller marshaller = jc.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); marshaller.marshal(child, System.out); }
From source file:Main.java
public static void main(String[] args) throws JAXBException { JAXBContext context = JAXBContext.newInstance(PayTypeList.class); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); PayTypeList paymentType = new PayTypeList(); List<String> paymentTypes = new ArrayList<String>(); paymentTypes.add("one"); paymentTypes.add("two"); paymentTypes.add("three"); paymentType.setPayType(paymentTypes); m.marshal(paymentType, System.out); }
From source file:MyPerson.java
public static void main(String[] args) throws JAXBException { MyPerson p = new MyPerson(); p.first = "l"; p.last = "h"; JAXBContext context = JAXBContext.newInstance(MyPerson.class); Marshaller marshaller = context.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); marshaller.marshal(p, System.out); }
From source file:Main.java
public static void main(String[] args) throws JAXBException { Child child = new Child(); child.age = 55;//from www.java 2 s . co m Main parent = new Main(); parent.child = child; JAXBContext context = JAXBContext.newInstance(Main.class); Marshaller marshaller = context.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); marshaller.marshal(parent, System.out); }