marshal/unmarshal 2 different classes that are based on 2 different schemas

hari

New Member
Im trying to configure a jaxb2Marshaller in spring beans config file but Im pretty new to Spring and JAXB so i might be going about it the wrong way.What i want to achieve is the same bean that will marshal/unmarshal 2 different classes that are based on 2 different schemas. Perhaps thats not possible because when i have both configured and run my tests they fail for the second class in the configuration (AccountResponse).This is the XML configuration:\[code\]<bean id="jaxb2Marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"> <property name="marshallerProperties"> <map> <entry key="com.sun.xml.bind.namespacePrefixMapper"> <bean id="NamespacePrefixMapperImpl" class="org.lp.soa.controller.xml.LpsNamespacePrefixMapper" /> </entry> </map> </property> <property name="classesToBeBound"> <list> <value>org.lp.soa.controller.data.request.AccountRequest</value> <value>org.lp.soa.controller.data.response.AccountResponse</value> </list> </property> <property name="schemas"> <list> <value>classpath:schema/AccountRequest.xsd</value> <value>classpath:schema/AccountResponse.xsd</value> </list> </property></bean>\[/code\]if i comment out the AccountRequest.xsd value from the config and then run my tests again the marshal/unmarshal for the second class (AccountResponse) they all pass, if I then uncomment it I get the error: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'accountResponse'.Am i going about it the wrong way? Is it not supposed to be possible to handle two classes with two schemas?Thanks,Yoav.
 
Back
Top