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 » Parsing "<" character in IIB

Post new topic  Reply to topic
 Parsing "<" character in IIB « View previous topic :: View next topic » 
Author Message
varunraot
PostPosted: Sun Nov 13, 2016 3:05 am    Post subject: Parsing "<" character in IIB Reply with quote

Acolyte

Joined: 01 Jun 2011
Posts: 63

Is there any way to parse the XML containing character ("<") in IIB?


<SapMsel>
<MSID>100000000135428843</MSID>
<ATNAM>ZPPI_INSP_CHARAC_NAME_37</ATNAM>
<ATWRT>CWI - Lip pickoff < 250 mil</ATWRT>
<ATFOR>CHAR</ATFOR>
</SapMsel>

I have read various posts/articles about this including accepting it as BLOB and then converting to CDATA.

I am not sure if there is a workaround for this?
Back to top
View user's profile Send private message
smdavies99
PostPosted: Sun Nov 13, 2016 6:44 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.

Have you actually validated that XML?
Perhaps it is invalid
_________________
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
nelson
PostPosted: Sun Nov 13, 2016 9:49 am    Post subject: Reply with quote

Partisan

Joined: 02 Oct 2012
Posts: 313

Check this:

https://www.ibm.com/support/knowledgecenter/SSMKHH_9.0.0/com.ibm.etools.mft.doc/ac67174_.htm

You should do something like:

Code:
SET OutputRoot.XMLNSC.Output.(XMLNSC.CDataField)Field1 = 'CWI - Lip pickoff < 250 mil';
Back to top
View user's profile Send private message
timber
PostPosted: Sun Nov 13, 2016 10:19 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1280

If that XML document is presented to *any* XML parser then it will be rejected because it is 'badly formed'.
Quote:
Is there any way to parse the XML containing character ("<") in IIB?
Yes, but only if the < is represented using the XML character entity &lt;
Quote:
I have read various posts/articles about this including accepting it as BLOB and then converting to CDATA.
I don't see how that could work. The most obvious solution is to fix the application that is sending this invalid XML. Is there a reason why you are not doing that?
Back to top
View user's profile Send private message
varunraot
PostPosted: Sun Nov 13, 2016 8:51 pm    Post subject: Reply with quote

Acolyte

Joined: 01 Jun 2011
Posts: 63

@smdavies99 : Yes. Its an invalid XML and does not conform to the XML specification. Thatswhy my question was around this to check if there is any workaround.

@nelson: IIB is at receiving end of this XML message( perhaps invalid XML!) and there are many repeating structures of such segments ( SapMsel in below case). Since this kind of bad XML does not even get parsed completely at the beginning of the flow, there is no question of formatting the message with CDATA in ESQL in subsequent nodes.

It would be easier if its outgoing message from IIB where we can embedded with escape characters or with CDATA. However it is not the case here.

@timber : Good thought. Even I have the same opinion that converting to BLOB, converting to CDATA in a field and then converting back to XML does not work. However I just want to be sure that there are no other workaround.

Also, this bad XML comes from a manufacturing space involving SAP and seems like SAP has the limitation of not able to fix this bad formed XML at their end.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Sun Nov 13, 2016 11:22 pm    Post subject: Reply with quote

Jedi Council

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

As you pointed out, this is a SAP bug and they must fix it.
That said,
if you can guarantee that the "<" will always be followed by a space then you could read the message as a BLOB and use ESQL Replace to find the "< " (cast as a blob) and replace it with a valid text that has the "<" escaped as described by Timber plus a space( all cast as a blob)

Sods law will dictate that two months down the line there will be some messages from SAP that don't always have the space and your 'Bodge' will blow up and you will get the blame.
That's why I call it a Bodge.

So get SAP to fix their XML. They are in the wrong.
_________________
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
fjb_saper
PostPosted: Mon Nov 14, 2016 5:17 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

Depending on what the SAP Source is and how (fast) it is fixable, one possibility would be to get the SAP raw data, parse it using DFDL and then transform / map to XMLNSC.

This would most probably fix the problem.

Also make sure to always use the latest SAP adapter (lot of fixes).

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Parsing "<" character in IIB
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.