|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
XML Parsing error - '&' character |
« View previous topic :: View next topic » |
Author |
Message
|
gecs |
Posted: Thu Aug 15, 2013 11:31 pm Post subject: XML Parsing error - '&' character |
|
|
 Acolyte
Joined: 14 Nov 2007 Posts: 58
|
Hi everybody,
My flow gets this message from a queue (as a Bitstream):
Code: |
<OH>26101001014901237</OH><AV>PEA00140NO HAY MAS RELACIONES </AV><SG>PEC6 B MG0000242 BARRERA MEJIA GRUPO DEL MIEMB RELIQUIA 01945777 GRUPO DEL MIEMB 02260964 GRUPO DEL MIEMB 04206860 GRUPO DEL MIEMB MARMOLAR REVESTIMIEN 04208730 GRUPO DEL MIEMB OSCAR COLMENA&ES ALMODOVAR 04210158 </SG> |
As you see, in this XML message exists an '&' char so when I parse using XMLNSC domain
Code: |
DECLARE options INTEGER BITOR(FolderBitStream, ValidateNone);
CREATE LASTCHILD OF Environment DOMAIN 'XMLNSC'
PARSE(blobTemp,,InputRoot.Properties.CodedCharSetId,,,,options);
|
where:
"blobTemp" is the input message casted as BLOB
The flow throws an exception like this:
Code: |
Exception = ( ['MQROOT' : 0xec2410]
(0x01000000:Name):RecoverableException = (
(0x03000000:NameValue):File = '/build/S700_P/src/DataFlowEngine/ImbTraceNode.cpp' (CHARACTER)
(0x03000000:NameValue):Line = 341 (INTEGER)
(0x03000000:NameValue):Function = 'ImbTraceNode::evaluate' (CHARACTER)
(0x03000000:NameValue):Type = 'ComIbmTraceNode' (CHARACTER)
(0x03000000:NameValue):Name = 'spfi/pec6/MF_RqRs#FCMComposite_1_13' (CHARACTER)
(0x03000000:NameValue):Label = 'spfi.pec6.MF_RqRs.T_FinWS' (CHARACTER)
(0x03000000:NameValue):Catalog = 'BIPmsgs' (CHARACTER)
(0x03000000:NameValue):Severity = 3 (INTEGER)
(0x03000000:NameValue):Number = 2230 (INTEGER)
(0x03000000:NameValue):Text = 'Caught exception and rethrowing' (CHARACTER)
(0x01000000:Name ):ParserException = (
(0x03000000:NameValue):File = '/build/S700_P/src/MTI/MTIforBroker/GenXmlParser4/ImbXMLNSCParser.cpp' (CHARACTER)
(0x03000000:NameValue):Line = 959 (INTEGER)
(0x03000000:NameValue):Function = 'ImbXMLNSCParser::parseRightSibling' (CHARACTER)
(0x03000000:NameValue):Type = '' (CHARACTER)
(0x03000000:NameValue):Name = '' (CHARACTER)
(0x03000000:NameValue):Label = '' (CHARACTER)
(0x03000000:NameValue):Catalog = 'BIPmsgs' (CHARACTER)
(0x03000000:NameValue):Severity = 3 (INTEGER)
(0x03000000:NameValue):Number = 5009 (INTEGER)
(0x03000000:NameValue):Text = 'XML Parsing Errors have occurred' (CHARACTER)
(0x01000000:Name ):ParserException = (
(0x03000000:NameValue):File = '/build/S700_P/src/MTI/MTIforBroker/GenXmlParser4/ImbXMLNSCDocHandler.cpp' (CHARACTER)
(0x03000000:NameValue):Line = 634 (INTEGER)
(0x03000000:NameValue):Function = 'ImbXMLNSCDocHandler::handleParseErrors' (CHARACTER)
(0x03000000:NameValue):Type = 'ComIbmSOAPInputNode' (CHARACTER)
(0x03000000:NameValue):Name = 'spfi/pec6/MF_RqRs#FCMComposite_1_1' (CHARACTER)
(0x03000000:NameValue):Label = 'spfi.pec6.MF_RqRs./spfi/pec6/' (CHARACTER)
(0x03000000:NameValue):Catalog = 'BIPmsgs' (CHARACTER)
(0x03000000:NameValue):Severity = 3 (INTEGER)
(0x03000000:NameValue):Number = 5004 (INTEGER)
(0x03000000:NameValue):Text = 'An XML parsing error has occurred while parsing the XML document' (CHARACTER)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 2 (INTEGER)
(0x03000000:NameValue):Text = '1540' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 2 (INTEGER)
(0x03000000:NameValue):Text = '2' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 2 (INTEGER)
(0x03000000:NameValue):Text = '1' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 2 (INTEGER)
(0x03000000:NameValue):Text = '675' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = 'The reference to entity "ES" must end with the '';'' delimiter.' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = '/Root/HOSTRs/SG' (CHARACTER)
)
)
)
)
) |
A simple solution that I tried is replace '&' by its respective XML entity '&' and this works fine... but I want to know if exists any "elegant"/better solution, beacuse of, if I decide to use the "replace", I will have to apply to all XML entities and probably affect the performance...
Addiotional info:
MB & WMBT 7.0.0.4
MQ 7.0
Thanks in advance.  |
|
Back to top |
|
 |
kimbert |
Posted: Fri Aug 16, 2013 12:18 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
The fault is in the sending application. It is not sending well-formed XML. It should be replacing '&' with '&' before putting the message on the MQ queue. _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
 |
mqsiuser |
Posted: Fri Aug 16, 2013 1:01 am Post subject: |
|
|
 Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
The sending application is an old legacy application
It originally uses a flat file format to send/receive data
Someone wrote something to create XML (a bit)
Make sure that "XML entities" get properly put in (as kimbert says)
Or use the native flat file interface and parse it with message sets in broker (to avoid problems that may occur from implementing your own "XML parser")
I can see the good intention to lift up the quality of the flat file interface, and it usually works good on the outbound, but less good on the inbound!
I would keep the flat file interface! _________________ Just use REFERENCEs
Last edited by mqsiuser on Fri Aug 16, 2013 1:18 am; edited 2 times in total |
|
Back to top |
|
 |
dogorsy |
Posted: Fri Aug 16, 2013 1:10 am Post subject: |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
Quote: |
A simple solution that I tried is replace '&' by its respective XML entity '&' and this works fine... but I want to know if exists any "elegant"/better solution, beacuse of, if I decide to use the "replace", I will have to apply to all XML entities and probably affect the performance...
|
yes, you could do that, and then you will have problems with embedded quotes, or embedded less than, or greater than signs... etc...  |
|
Back to top |
|
 |
mqsiuser |
Posted: Fri Aug 16, 2013 1:18 am Post subject: |
|
|
 Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
Try to use the product (Message Broker) in the right way and offload that burden from the attached applications.
YOU should be doing the integration work.
Here is how I model flat file message formats (you can ask questions about it in the forum if it does not work)
XML is a bit lengthy standard. E.g. JSON is simpler. You are not quickly implementing a "fully compliant" xml parser (reader/writer) easily.
Though "xml entities" and the right code page is the only thing I currently think of... for your current approach (probably already agreed by all parties and can't be made undone ). _________________ Just use REFERENCEs |
|
Back to top |
|
 |
kimbert |
Posted: Fri Aug 16, 2013 1:24 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I agree with mqsiuser. If you have the choice then it would be easier to leave the flat file format in its current form. If it's a COBOL format then use the COBOL importer to create a message set ( if on v6/v7) or a DFDL schema ( if on v8/v9). _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
 |
mqsiuser |
Posted: Fri Aug 16, 2013 3:55 am Post subject: |
|
|
 Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
There are discussion like this in the forum
YOU have the great integration tool
Your partners do not. You can help them, by being tolerant with what you accept and pleasing with what you send.
Depending on the status of agreements (that you and they made) and their abilities and willingness to change that (and their interface(s)) ...
(though probably they shouldn't do any changes to their interfaces... just use their native (flat file) interface(s))
... you may even fix their XML, by taking it in as a BLOB and replace/escaping the characters (&-->&). Because "&" (except the use within XML Entities is always wrong within XML). That is against the idea of XML though (well-formedness). It's just not XML (what they send). I am just telling you an option (not really recommending it). After correcting (with BLOB) you can then use XMLNSC.
Though parsing COBOL probably is difficult and I would always use some provided msg sets. _________________ Just use REFERENCEs |
|
Back to top |
|
 |
gecs |
Posted: Fri Aug 16, 2013 9:07 am Post subject: |
|
|
 Acolyte
Joined: 14 Nov 2007 Posts: 58
|
Thank everyone (mqsiuser,kimbert,dogorsy) for your advices. Below, my opinion based on what you wrote:
- This is the scenario and why the Integrator is used:
soap/xml bitstream
Clients <--------> Middleware (MB) <----------> CICS(cobol transactions)
- As you told, the "best" solution will be that Flow receive the XML well-formed, but I doubt COBOL developers accept to apply changes for the message...
- Use a message set (importing COBOL copy) to parse the message... sounds fine, but don't exists COBOL copy, that is the reason for not using MRM domain... ¿create it? Sure, but demands time in modeling and test, specially in Test, since sometimes the message comes in other way (another tags, another order, with/without ocurrences, etc...)
- leave the flat file format in its current form, replace '&' char and give it to the Client (or maybe send it as CData) and they do the parsing, mapping logic, etc... sounds better, but This would imply modify several interfaces, although it takes less time than above ideas... (I think).
Sincerely, thanks for your time...
Regards  |
|
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
|
|
|
|