Originally posted by: paul.brett
I've had some inquiries about why XML encoded strings get 'messed-up' when the data in question is parsed into an anyElem object.
Please review the enclosed example.
On input I have two types of data:
Data = Test & String
Stuff = any & elem
When reading this data into WTX, Data is read as XML, and the '&' is stripped back to just '&' and when mapped to a text object (see Output.txt) you get '&'. Stuff is read as non-XML, and the '&' is not stripped back and when mapped to a text object (see Output.txt) you get '&'.
When mapping out to an XSD based card, the outputs are:
Data[1] = Test & String
Data[2] = <Stuff>any &amp; elem</Stuff>
...and as you can see, all the XML elements have been encoded, but the '&' has been double-encoded to '&amp;'.
This is not a bug, but a side-effect of using the anyElem feature of XML processing.
....
Can anybody suggest any elegant ways to avoid this double encoding?
My solution would be to pass the output to a RUN() map as a text blob, and do some SUBSTITUTE() functions to remove any double encoding, before writing it out. Perhaps you know a better way?
Thank-you.
Paul.
Follow me on Twitter
#DataExchange#IBMSterlingTransformationExtender#IBM-Websphere-Transformation-Extender