0

I use scalaxb.toXML to parse an object to xml and send it using soap.

When I have XML character reference in some string property, scalaxb.toXML encodes even the XML character.

How to avoid the encode of XML characters? Or escape it?

My string: Cancellation Fees 

 - Until 30 days before departure: 20% of the product price

My result (cleaned up):

<soap11:Envelope xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/" ...>
    ...
    <mbm:order-remark text="Cancellation Fees &amp;#xd;&amp;#xa;&amp;#xd;&amp;#xa; - Until 30 days before departure: 20% of the product price" position="0" />
    ...
</soap11:Envelope>

Each & is being encoded to &amp; to avoid structural problems with my XML, even when they are valid.

How I call scalaxb.toXML:

scalaxb.toXML(obj, namespace, elementLabel, scope)
  • `&` should be encoded in XML according to the standard. I think you only can replace you XML, bad it seems as a bad idea – Mikhail Ionkin Apr 28 '22 at 21:02
  • Hi @MikhailIonkin even when the `&` is folowed by a valid sequence? ` ` is the XML representation for `\r\n`. Thanks for your quick answer – Ricardo Valim Apr 29 '22 at 08:28

0 Answers0