Search code examples
spring-wsspring-oxm

Spring Jaxb2Marshaller not call CharacterEscapeHandler


I tried my best to figure it out, but failed. The Spring Jaxb2Marshaller seem ignored CharacterEscapeHandler ! :-(

Here is my code:

<bean id="aisWsMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
    <property name="contextPath" value="com.capgemini.manulife.integration.generated.ais.ws.oneshot"/>
    <property name="marshallerProperties">
        <map>
            <entry key="com.sun.xml.bind.characterEscapeHandler" value-ref="noEscapeCharacterHandler">
            </entry>
        </map>
    </property>
</bean>

<bean id="noEscapeCharacterHandler" class="com.capgemini.manulife.integration.NoEscapeCharacterHandler">

</bean>


public class NoEscapeCharacterHandler implements CharacterEscapeHandler {

@Override
public void escape(char[] ch, int start, int length, boolean isAttVal, Writer out) throws IOException {
     out.write(ch, start, length);
    System.out.println("AAAA");
}

} Really tired :-(


Solution

  • It is Spring Integration Jaxb2Marshaller Bug !