Note that there are some explanatory texts on larger screens.

plurals
  1. POmarshal/unmarshal 2 different classes that are based on 2 different schemas
    primarykey
    data
    text
    <p>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.</p> <p>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).</p> <p>This is the XML configuration:</p> <pre><code>&lt;bean id="jaxb2Marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"&gt; &lt;property name="marshallerProperties"&gt; &lt;map&gt; &lt;entry key="com.sun.xml.bind.namespacePrefixMapper"&gt; &lt;bean id="NamespacePrefixMapperImpl" class="org.lp.soa.controller.xml.LpsNamespacePrefixMapper" /&gt; &lt;/entry&gt; &lt;/map&gt; &lt;/property&gt; &lt;property name="classesToBeBound"&gt; &lt;list&gt; &lt;value&gt;org.lp.soa.controller.data.request.AccountRequest&lt;/value&gt; &lt;value&gt;org.lp.soa.controller.data.response.AccountResponse&lt;/value&gt; &lt;/list&gt; &lt;/property&gt; &lt;property name="schemas"&gt; &lt;list&gt; &lt;value&gt;classpath:schema/AccountRequest.xsd&lt;/value&gt; &lt;value&gt;classpath:schema/AccountResponse.xsd&lt;/value&gt; &lt;/list&gt; &lt;/property&gt; &lt;/bean&gt; </code></pre> <p>if i comment out the <strong>AccountRequest.xsd</strong> 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'.</p> <p>Am i going about it the wrong way? Is it not supposed to be possible to handle two classes with two schemas?</p> <p>Thanks, Yoav.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload