List of usage examples for org.springframework.oxm.jaxb Jaxb2Marshaller setMarshallerProperties
public void setMarshallerProperties(Map<String, ?> properties)
From source file:org.bremersee.common.spring.autoconfigure.JaxbAutoConfiguration.java
public static Jaxb2Marshaller createJaxbMarshaller(final Collection<String> packages) { final Set<String> packageSet = createPackageSet(packages); Jaxb2Marshaller m = new Jaxb2Marshaller(); Map<String, Object> marshallerProperties = new HashMap<>(); marshallerProperties.put(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); m.setMarshallerProperties(marshallerProperties); m.setContextPaths(packageSet.toArray(new String[packageSet.size()])); return m;// w w w. ja va2s .c o m }
From source file:com.cisco.cta.taxii.adapter.persistence.PersistenceConfiguration.java
@Bean public Jaxb2Marshaller taxiiStatusMarshaller() { Jaxb2Marshaller jaxb2Marshaller = new Jaxb2Marshaller(); jaxb2Marshaller.setClassesToBeBound(TaxiiStatus.class); jaxb2Marshaller .setMarshallerProperties(ImmutableMap.of(javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, true)); return jaxb2Marshaller; }
From source file:frk.gpssimulator.GpsSimulatorApplication.java
@Bean public Jaxb2Marshaller getMarshaller() { Jaxb2Marshaller jaxb2Marshaller = new Jaxb2Marshaller(); jaxb2Marshaller.setClassesToBeBound(Kml.class); final Map<String, Object> map = new HashMap<>(); map.put("jaxb.formatted.output", true); jaxb2Marshaller.setMarshallerProperties(map); return jaxb2Marshaller; }
From source file:demo.GpsSimulatorApplication.java
@Bean public Jaxb2Marshaller getMarshaller() { final Jaxb2Marshaller jaxb2Marshaller = new Jaxb2Marshaller(); jaxb2Marshaller.setClassesToBeBound(Kml.class); final Map<String, Object> map = new HashMap<>(); map.put("jaxb.formatted.output", true); jaxb2Marshaller.setMarshallerProperties(map); return jaxb2Marshaller; }
From source file:org.cruk.genologics.api.jaxb.JaxbAnnotationTest.java
@Test @SuppressWarnings("unchecked") public void testExceptionSimple() throws Throwable { // Cannot use configured because of aspects. Jaxb2Marshaller exceptionMarshaller = new Jaxb2Marshaller(); exceptionMarshaller.setPackagesToScan(new String[] { "com.genologics.ri.exception" }); exceptionMarshaller .setMarshallerProperties(context.getBean("genologicsJaxbMarshallerProperties", Map.class)); Jaxb2Marshaller original = marshaller; try {//from w ww. j a v a 2 s .c o m marshaller = exceptionMarshaller; fetchMarshalAndCompare(com.genologics.ri.exception.Exception.class); } finally { marshaller = original; } }
From source file:org.cruk.genologics.api.jaxb.SerializationTest.java
@Test @SuppressWarnings("unchecked") public void testExceptionSimple() throws Throwable { // Cannot use configured because of aspects. Jaxb2Marshaller exceptionMarshaller = new Jaxb2Marshaller(); exceptionMarshaller.setPackagesToScan(new String[] { "com.genologics.ri.exception" }); exceptionMarshaller .setMarshallerProperties(context.getBean("genologicsJaxbMarshallerProperties", Map.class)); Jaxb2Marshaller original = marshaller; try {// www . j a v a 2 s . com marshaller = exceptionMarshaller; fetchMarshalAndSerialize(com.genologics.ri.exception.Exception.class); } finally { marshaller = original; } }