|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Parsing Error |
« View previous topic :: View next topic » |
Author |
Message
|
LozzaKib |
Posted: Thu Apr 05, 2007 7:50 am Post subject: Parsing Error |
|
|
Newbie
Joined: 05 Apr 2007 Posts: 1
|
Hi,
Wonder if anyone can help me?
I'm a trainee flow developer and I'm struggling trying to extract the nested XML message in the APPDATA tag of the CDATA section of the message below. Basically we have an XML message which contains a CDATA section which contains another XML message. This message has been thrown out by an application; the application has then wrapped various Error tags around around the original message
<IBISMSG><APPDATA><![CDATA[<?xml version="1.0"?>
<IBISMSG version="1.1">
<SYSHEADER>
<SERVICEID>SPT1.RQSM1</SERVICEID>
<TO>QMY2.CALL.AIQ.001</TO>
<FROM>QMY2.CALL.AIQ.001</FROM>
<MESSAGEGROUP>N</MESSAGEGROUP>
<MESSAGESEQ>1</MESSAGESEQ>
<LASTMESSAGEGROUP>Y</LASTMESSAGEGROUP>
<INTIMESTAMP/>
<OUTTIMESTAMP/>
</SYSHEADER>
<APPDATA><?xml version = "1.0" encoding="UTF-8" standalone="yes"?><costallocationrequest><jobid>000000001</jobid><modelid>000000002</modelid><requestpartno>000000001</requestpartno></costallocationrequest><APPHDR>
<TOAPP>Client Message</TOAPP>
<FROMAPP/>
<OWNERDEPOT/>
<MARKER/>
<REFID/>
</APPHDR>
</APPDATA>
</IBISMSG>
]]></APPDATA><APPERROR><ERRORSOURCE>IBRCVAPI </ERRORSOURCE><ERRORNODE> </ERRORNODE><ERROR>999 </ERROR><ERRORDESC>IBAI07 - NO ROUTING DATA FOUND FOR SPT1.RQSM1 </ERRORDESC><ERRORTIME>2007-04-05 15:55:12</ERRORTIME></APPERROR><SYSHEADER><OUTTIMESTAMP>2007-04-05 15:55:12</OUTTIMESTAMP></SYSHEADER></IBISMSG>
I'm curently getting a parsing error when trying to reference the APPDATA tag in the CDATA section.
I basically want to extract the APPDATA so I can insert it into an Oracle database.
Any ideas?
 |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Apr 05, 2007 8:32 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
What parser error?
What is the code you're using to access it? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
dkeister |
Posted: Thu Apr 05, 2007 9:47 am Post subject: |
|
|
Disciple
Joined: 25 Mar 2002 Posts: 184 Location: Purchase, New York
|
My solution was not sophisticated, but it worked. Hopefully someone will show a smarter way to do this.
I created a MRM/TDS message that contains one element called InputMessage.
In my application I read the message as XML, do some processing and then if I need to extract the CDATA I have a Reset Content Descriptor node to use the MRM/TDS format. I can then use ESQL to:
set s = InputRoot.MRM.InputMessage;
-- Get cdata material
set I = position('<![CDATA[' in s);
while I <> 0 do
set s = substring(s from 1 for (I - 1)) || substring(s from (I + 9));
set I = position('<![CDATA[' in s);
end while;
set I = position(']]>' in s);
while I <> 0 do
set s = substring(s from 1 for (I - 1)) || substring(s from (I + 3));
set I = position(']]>' in s);
end while;
set OutputRoot.MRM.InputMessage = s;
On exit from the node I use another RCD to use the XML parser.
As I say, it ain't elegant, but it works. _________________ Dean Keister |
|
Back to top |
|
 |
kimbert |
Posted: Thu Apr 05, 2007 1:52 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I think you're making this a lot harder than it needs to be.
- If the MRM parser does not build the tree that you want, use XMLNS or XMLNSC instead. Both of those parsers will extract the contents of the CDATA automatically, and will mark the node as a CDATA node.
- Your use of the MRM TDS parser is overkill. Why not simply take the value of InputRoot.MRM.APPDATA and use SUBSTRING to split it up?
You are not the only person to do this, but statements like 'I'm curently getting a parsing error' do not convey very much information. You should either quote the error accurately or not mention it at all. |
|
Back to top |
|
 |
dkeister |
Posted: Fri Apr 06, 2007 3:18 am Post subject: |
|
|
Disciple
Joined: 25 Mar 2002 Posts: 184 Location: Purchase, New York
|
Thanks Kimbert, I know the way I solved this problem was probably not the easist way. Thanks for the suggestions.
Dean _________________ Dean Keister |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|