Author |
Message
|
gag_nm |
Posted: Tue Jan 26, 2010 11:31 pm Post subject: Error While Parsing |
|
|
Centurion
Joined: 16 Oct 2008 Posts: 102
|
Hi,
can some please help ,
In Request message we have below tag and value as given with in tag.
<Request>
<ID>E4560</ID>
<Name>NAGARDAS MANJI & CO</Name>
</Request>
at MqInput Node ,values are given below under InputMessage Parser Options
Message domain is MRM
Message Format is XML1
MessageSet : MsgFromClientMsgS (EBB14IK002001)
Input Message is failing at node and routing to Failure Terminal.
Issue is at Input Node Parser is Failing because of " & ", and giving below
error Message
<Name>NAGARDAS MANJI & CO</Name>
I searched for this exception in google and found that space&space(" & ")
will be treated as special character by Parser.
can you please give me some suggestion to solve this issue from broker end.
because lot of Customer Names has " & " in their Name Tag.
----------------------------------
EXCEPTION
----------------------------------
ExceptionList
RecoverableException
File:CHARACTER:F:\build\S610_P\src\DataFlowEngine\ImbDataFlowNode.cpp
Line:INTEGER:957
Function:CHARACTER:ImbDataFlowNode::createExceptionList
Type:CHARACTER:ComIbmMQInputNode
Name:CHARACTER:XMLTOMRMMsgFlow#FCMComposite_1_1
Label:CHARACTER:XMLTOMRMMsgFlow.MQInput
Catalog:CHARACTER:BIPv610
Severity:INTEGER:3
Number:INTEGER:2230
Text:CHARACTER:Node throwing exception
RecoverableException
File:CHARACTER:F:\build\S610_P\src\DataFlowEngine\ImbTraceNode.cpp
Line:INTEGER:341
Function:CHARACTER:ImbTraceNode::evaluate
Type:CHARACTER:ComIbmTraceNode
Name:CHARACTER:XMLTOMRMMsgFlow#FCMComposite_1_4
Label:CHARACTER:XMLTOMRMMsgFlow.Trace
Catalog:CHARACTER:BIPv610
Severity:INTEGER:3
Number:INTEGER:2230
Text:CHARACTER:Caught exception and rethrowing
ParserException
File:CHARACTER:F:\build\S610_P\src\MTI\MTIforBroker\MtiImbParser2\MtiImbParser.cpp
Line:INTEGER:730
Function:CHARACTER:MtiImbParser::parseRightSibling
Type:CHARACTER:ComIbmMQInputNode
Name:CHARACTER:XMLTOMRMMsgFlow#FCMComposite_1_1
Label:CHARACTER:XMLTOMRMMsgFlow.MQInput
Catalog:CHARACTER:BIPv610
Severity:INTEGER:3
Number:INTEGER:5285
Text:CHARACTER:ImbRecoverableException caught from
worker->parseNext.
Insert
Type:INTEGER:5
Text:CHARACTER:XMLTOMRMMsgSet
Insert
Type:INTEGER:2
Text:CHARACTER:1
Insert
Type:INTEGER:5
Text:CHARACTER:XML1
Insert
Type:INTEGER:5
Text:CHARACTER:/Request/Name
ParserException
File:CHARACTER:F:\build\S610_P\src\cpi\pwf\xml\xmlhandler.cpp
Line:INTEGER:1349
Function:CHARACTER:XMLHandler::error
Type:CHARACTER:
Name:CHARACTER:
Label:CHARACTER:
Catalog:CHARACTER:BIPv610
Severity:INTEGER:3
Number:INTEGER:5117
Text:CHARACTER:XMLHandler::error reported from the Xerces parser
Insert
Type:INTEGER:2
Text:CHARACTER:226
Insert
Type:INTEGER:5
Text:CHARACTER:Null pointer
Insert
Type:INTEGER:2
Text:CHARACTER:3
Insert
Type:INTEGER:2
Text:CHARACTER:14
Insert
Type:INTEGER:5
Text:CHARACTER:Expected entity name for reference
Insert
Type:INTEGER:5
Text:CHARACTER:Request
Insert
Type:INTEGER:5
Text:CHARACTER:Name |
|
Back to top |
|
 |
WMBDEV1 |
Posted: Tue Jan 26, 2010 11:48 pm Post subject: |
|
|
Sentinel
Joined: 05 Mar 2009 Posts: 888 Location: UK
|
Escape the & character as required by the XML spec |
|
Back to top |
|
 |
exerk |
Posted: Tue Jan 26, 2010 11:55 pm Post subject: |
|
|
 Jedi Council
Joined: 02 Nov 2006 Posts: 6339
|
Moved to the Broker forum... _________________ It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys. |
|
Back to top |
|
 |
gag_nm |
Posted: Tue Jan 26, 2010 11:57 pm Post subject: |
|
|
Centurion
Joined: 16 Oct 2008 Posts: 102
|
Thanks for your Reply,
U want me to remove " & " in tag <Name>NAGARDAS MANJI & CO</Name>
before reaching Broker.  |
|
Back to top |
|
 |
kimbert |
Posted: Wed Jan 27, 2010 12:08 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Why are you using MRM XML? Which version of the runtime are you using?
The input message is not well-formed XML. You should speak to the provider of the input message and ask them to escape any '<' and '&' characters which occur within attribute and tag values. |
|
Back to top |
|
 |
gag_nm |
Posted: Wed Jan 27, 2010 12:16 am Post subject: |
|
|
Centurion
Joined: 16 Oct 2008 Posts: 102
|
Iam using Broker 6.1.0.5
we are using MRM Messsage domain to validate input message against Respective Message Set(to validate length of value) |
|
Back to top |
|
 |
kimbert |
Posted: Wed Jan 27, 2010 12:47 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
|
Back to top |
|
 |
gag_nm |
Posted: Wed Jan 27, 2010 1:32 am Post subject: |
|
|
Centurion
Joined: 16 Oct 2008 Posts: 102
|
thanks for your Reply kimbert.
this Message Flows were developed long time back in Version 5, after that we migrated to next higher Versions with same MRM XML.
that is the reason we are using the same flows. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Jan 27, 2010 5:09 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
To be clear.
The & in the XML document makes it an illegal XML document. Regardless of what parser you use.
It's bad data. The sender is doing the wrong thing.
You should spend the time *now* to migrate your flows to use XMLNSC instead of MRM. Every time you change any one of your flows, you should do this migration as well.
It will save you time and money because it WILL give you a HUGE performance improvement. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Jan 27, 2010 4:13 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
can you please give me some suggestion to solve this issue from broker end |
Not really. Not a good suggestion, anyway. You would need to write some ESQL or Java which would understand the structure of the XML. Then, within each tag or attribute value, you would need to detect all &'s which are not intended to be XML character refs/entities and replace them with &.
In other words, you would need to write a custom XML-like parser in Java/ESQL. |
|
Back to top |
|
 |
francoisvdm |
Posted: Wed Jan 27, 2010 9:57 pm Post subject: |
|
|
Partisan
Joined: 09 Aug 2001 Posts: 332
|
The reality of the world is that not all source systems are willing to change or are easy to change. If you need to fix it from the brokewr side, read the message in as a blob, search for the offending characters, replace it with the escaped versions, then parse again. Yes, this is not the best, yes it will make your system slower and all the bad things said in this thread... but hey, sometimes it is the only way. _________________ If you do not know the answer or you get the urge to answer with "RTFM" or "Search better in this forum", please refrain from doing so, just move on to the next question. Much appreciated.
Francois van der Merwe |
|
Back to top |
|
 |
smdavies99 |
Posted: Wed Jan 27, 2010 11:31 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
francoisvdm wrote: |
The reality of the world is that not all source systems are willing to change or are easy to change. |
Those of us who have been around long enough know this only two well.
I've been in a situation where you go back to the vendor and tell them
"You are sending us invalid XML". You explain the problem and even give them a series of links to the XML standard.
They just sit there and say, "My guys say you are wrong. This is how they have always formatted the data".
Then you get that sinking feeling that somehow you have become part of a Dilbert strip and its your PHB saying that.
Reminds me of a bit of code in the DEC Ultrix (modded BSD 4.2) kernel. There is a comment that goes like:-
/* If you reach this point you are in deep dodo. There is no escape from here. */
HALT; _________________ 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 |
|
 |
kimbert |
Posted: Thu Jan 28, 2010 12:24 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
The reality of the world is that not all source systems are willing to change or are easy to change. |
Point taken. But gag_nm has not given us any information about that (yet). So I'm recommending the correct technical solution until he comes back and tells us that it is not viable.
It's a fact that some developers are too quick to try and fix the problem when it really should and could be fixed elsewhere.
Quote: |
If you need to fix it from the brokewr side, read the message in as a blob, search for the offending characters, replace it with the escaped versions, then parse again. |
I agree - that is one alternative solution. But it will be tricky to distinguish the 'offending' &'s from perfectly legal ones.
Example: What should gag_nm do if there is an un-escaped & within a CData section? |
|
Back to top |
|
 |
gag_nm |
Posted: Fri Jan 29, 2010 7:32 am Post subject: |
|
|
Centurion
Joined: 16 Oct 2008 Posts: 102
|
Thanks for all your valuable suggestions, i apperciate for all your support.
I explained vendor we have 2 ways to solved this issue
1) send xml with out special charaters(i.e validate message at their end)
2) send xml in charater stream data format,which our parser will accept even "&" special charaters .
He has agreed to validate xml message and remove special charaters from his end. |
|
Back to top |
|
 |
Vitor |
Posted: Fri Jan 29, 2010 7:41 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
gag_nm wrote: |
He has agreed to validate xml message and remove special charaters from his end. |
He doesn't need to remove them, though obviously that does fix the problem!
He just needs to present them correctly so the XML is well formed. In the example you supply
Code: |
<Name>NAGARDAS MANJI & CO</Name> |
will parse just fine and be resolved to "NAGARDAS MANJI & CO" as a string.
XML 101  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|