Wednesday, 17 September 2014

Spring 4.1 O/X mapping: validate inbound XML based on a schema?



Spring 4 O/X supports several XML unmarshallers behind its abstraction. We use JAXB2. Can it validate the XML against a schema? I didn't find anything in the official documentation nor in the spring-oxm schema that describe the configuration. This is my current configuration, pretty standard.



<bean id="jaxb2Marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<property name="marshallerProperties">
<map>
<!-- properties here -->
</map>
</property>
<property name="classesToBeBound">
<list>
<value>com.example.Message1</value>
<value>com.example.Message2</value>
</list>
</property>
</bean>

No comments:

Post a Comment