Page 1 of 1

XML Output Stage and apostrophes

Posted: Wed May 20, 2009 2:09 am
by wjfitzgerald
Hi,

I have a number of jobs creating XML messages.

One job is based on customer data, and so one of the fields involved is surname. This is causing a problem with apostrophes.

if the input data is "O'Brien", then it is being presented in the XML as <SURNAME>O&apos;Brien<\SURNAME>.

Is there anyway to get it to present as <SURNAME>O'Brien<\SURNAME>?

Thanks for the help.

John Fitz

Posted: Wed May 20, 2009 6:52 am
by chulett
That shouldn't be a problem as "&apos" is the correct way to represent that character in XML and anything that consumes XML should know (and translate) that. What issue does this cause? :?

Posted: Wed May 20, 2009 7:20 am
by wjfitzgerald
Craig,

the data is required to be placed in a further CDATA[] tag.eg <CARD_HOLDER_NAME><![CDATA[MS B NIC GIOLLA PHADRAIG]]></CARD_HOLDER_NAME>
this is a third party requirement that i have no control over.
the net effect of such a tag is to tell the parser to treat it's contents as text and not xml, and so the "&apos" is written to the DB.

As you say the "apos" is the correct representation, and that probably ends this conversation. i can get round it by using a convert function in a transformation stage ater the xml is created.

the real issue is that the XML stage cannot handle the CDATA[] requirement. i also having to add this manually to each xml field on the message.

Craig, thanks as always for coming back to me. i will leave this post open for a while in case you have any thoughts on the CDATA issue.otherwise i will mark it resolved at the end of the day

thanks again,

john fitz

Posted: Wed May 20, 2009 9:08 am
by chulett
OK, fair enough... if you need to retain it, set the Data Element for that column to XML and that will tell it that it is already XML and to leave it alone.

Posted: Wed May 20, 2009 9:16 am
by wjfitzgerald
That sounds like what i need to be doing.

Thanks.