Example usage for org.springframework.oxm.jaxb Jaxb2Marshaller setSchema

List of usage examples for org.springframework.oxm.jaxb Jaxb2Marshaller setSchema

Introduction

In this page you can find the example usage for org.springframework.oxm.jaxb Jaxb2Marshaller setSchema.

Prototype

public void setSchema(Resource schemaResource) 

Source Link

Document

Set the schema resource to use for validation.

Usage

From source file:org.springsource.greenbeans.examples.edawithspring.etailer.common.MarshallingTests.java

private Marshaller jaxb2Marshaller() throws Exception {
    Jaxb2Marshaller jaxb2Marshaller = new Jaxb2Marshaller();
    jaxb2Marshaller.setClassesToBeBound(PurchaseProcessingRequest.class, PurchaseLineItem.class);
    jaxb2Marshaller.setSchema(new ClassPathResource("/partner-schema.xsd"));
    jaxb2Marshaller.afterPropertiesSet();
    jaxb2Marshaller.setBeanClassLoader(Thread.currentThread().getContextClassLoader());
    return jaxb2Marshaller;
}

From source file:org.springsource.greenbeans.examples.edawithspring.etailer.common.CommonConfiguration.java

@Bean
public Marshaller marshaller() {
    Jaxb2Marshaller jaxb2Marshaller = new Jaxb2Marshaller();
    jaxb2Marshaller.setClassesToBeBound(PurchaseProcessingRequest.class, PurchaseLineItem.class,
            PurchaseProcessingResponse.class);
    jaxb2Marshaller.setSchema(partnerSchemaResource);
    return jaxb2Marshaller;
}