ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Escaping < while parsing the data against XMLNSC domain

Post new topic  Reply to topic
 Escaping < while parsing the data against XMLNSC domain « View previous topic :: View next topic » 
Author Message
najmaaaa
PostPosted: Sun Feb 19, 2012 5:38 am    Post subject: Escaping < while parsing the data against XMLNSC domain Reply with quote

Newbie

Joined: 19 Feb 2012
Posts: 4

Hi,

We expect an XML from the source system which can have & and <. So, the data is not a valid XML.
I am able to escape & and parse the data against XMLNSC domain. However, I am not able to escape < symbol that comes in the data. If I try replacing all < symbols that is present in the data to &lt; and then parse against XMLNSC, it throws error.

For example, my data would look like,

<root><child>abc<def</child></root>

Need to make this as a perfect XML like below.

<root><child>abc&lt;def</child></root>



SET varDATAContent = REPLACE(CAST(source.MRM.GenericData AS CHAR ), '&', '&amp;');
--SET varDATAContent = REPLACE(varDATAContent, '<', '&lt;');

CREATE LASTCHILD OF Data1 DOMAIN('XMLNSC') PARSE(CAST(varDATAContent AS BLOB CCSID 437 ENCODING 546));

It throws error if I uncomment the line that is commented in the above piece of code.

Can anyone help me in solving this problem.

Thank You,
Najma
Back to top
View user's profile Send private message
smdavies99
PostPosted: Sun Feb 19, 2012 5:54 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

Get the sending system to actually send a valid XML string.

There is no excuse for a system in this day and age to send invalid XML.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
Vitor
PostPosted: Sun Feb 19, 2012 7:04 am    Post subject: Re: Escaping < while parsing the data against XMLNSC doma Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

najmaaaa wrote:
Need to make this as a perfect XML like below.


The correct term is "well-formed".


najmaaaa wrote:
Can anyone help me in solving this problem.


You need the source system to send well formed XML; either by escaping the data or using CDATA or whatever method works in your implementation.

Failing that, you need far more code than a simple line to identify all the '<' & '>' which are not followed by their matching character but another such character & escaping the errent character. The accepted term for such activity is "parsing" and you'd be better off using a low level language like C or Java to attempt this doomed-to-failure exercise.

Tell whoever's sending you the file if it doesn't open in IE you can't process it.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Escaping < while parsing the data against XMLNSC domain
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.