XML Output Stage and apostrophes

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
wjfitzgerald
Participant
Posts: 72
Joined: Tue Feb 05, 2008 4:38 am

XML Output Stage and apostrophes

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
wjfitzgerald
Participant
Posts: 72
Joined: Tue Feb 05, 2008 4:38 am

Post 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
John Fitz
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
wjfitzgerald
Participant
Posts: 72
Joined: Tue Feb 05, 2008 4:38 am

Post by wjfitzgerald »

That sounds like what i need to be doing.

Thanks.
John Fitz
Post Reply