While generating XML using castor marshal method; if data object contains ‘&‘ character; it is getting converted into &

How to avoid this? I want the same character  back in XML message. Please help.

 

Sample code:

StringWriter writer = new StringWriter();

String xml = null;

dpMessage.marshal(writer);

xml = writer.toString();

 

 

Input data:

ELLSWORTH & GRAHAM BOOK SHOP Accounts/47-3423230

 

Output xml:

<DPMessage xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="DPMessage">

   <body>

            <detailedSummary>

                <dsCompanyName_TIN>ELLSWORTH &amp; GRAHAM BOOK SHOP Accounts/47-3423230</dsCompanyName_TIN>

            </detailedSummary>

    </body>

</DPMessage>

 

 

Thanks,

Pravin

 

Reply via email to