|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
MRM/XML Questions |
« View previous topic :: View next topic » |
Author |
Message
|
TonyD |
Posted: Sun Jun 12, 2005 4:01 am Post subject: MRM/XML Questions |
|
|
Knight
Joined: 15 May 2001 Posts: 540 Location: New Zealand
|
I am working on an application that uses the MRM parser for XML messages, an area that I have not have much experience so far. I have come across a couple of issues that are probably due to that inexperience and would appreciate comment...I have read the 'Help' topics but sometimes they are not totally clear.
1. I am mapping from one schema to another. I have a complex element as follows:
Code: |
<Client>
<ClientIdentifier>
<IdentifierType>XYZ</IdentifierType>
<IdentifierValue>99999999</IdentifierValue>
</ClientIdentifier>
|
'ClientIdentifier' is defined as 'minOccurs=0 maxOccurs=Unbounded' , IdentifierType and Identifier Value are defined as 'minOccurs=1'. In other words, if there is a 'ClientIdentifier' it must contain 1 * IdentifierType and 1 * Identifiervalue'!
The input message does not contain a 'ClientIdentifier' element. The ESQL recognises that the subordinate elements are not present and sets them to 'NULL' as would be expected:
Code: |
Assigning NULL to 'OutputRoot.MRM.cmdm:CMDMDataEntry[indexEntryOut].cmdm:Clients.cmdm:Client[indexClientOut].cmdm:ClientIdentifier.cmdm:IdentifierType', thus deleting it.
.....
Assigning NULL to 'OutputRoot.MRM.cmdm:CMDMDataEntry[indexEntryOut].cmdm:Clients.cmdm:Client[indexClientOut].cmdm:ClientIdentifier.cmdm:IdentifierValue', thus deleting it.
...
|
However the ouput message fails validation as it appears that the non-mandatory parent element 'ClientIdentifier' has been instantiated as an empty element.
Code: |
(0x01000013)http://www.xyz/Messages/CMDM/2005/05/CMDMXMLSchema_52:Clients = (
(0x01000013)http://www.xyz/Messages/CMDM/2005/05/CMDMXMLSchema_52:Client = (
(0x01000013)http://www.xyzMessages/CMDM/2005/05/CMDMXMLSchema_52:ClientIdentifier =
(0x03000013)http://www.xyz/Messages/CMDM/2005/05/CMDMXMLSchema_52:FamilyName = 'Jones 5'
|
The validation failure occurs because 'ClientIdentifier' does not contain its mandatory elements. My questions is, how do I prevent the empty element being created.
2. I have noticed that, when with respect to the above complex element when it DOES contain the two subordinate elements, I test 'IF....ClientIdentifier IS NULL' I get a 'TRUE' result, which makes things difficult. Testing CARDINALITY appears to be the only way to get a predictable result.
I have read the various sections in 'Help' (CSD04 level) with respect to NULL handling without understanding the behaviour that I have described above. I woud therefore be grateful for any explanation/comment/suggestions. |
|
Back to top |
|
 |
jefflowrey |
Posted: Sun Jun 12, 2005 12:38 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Can we see your code where you are mapping from one to the other? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
TonyD |
Posted: Sun Jun 12, 2005 3:46 pm Post subject: |
|
|
Knight
Joined: 15 May 2001 Posts: 540 Location: New Zealand
|
Code: |
SET OutputRoot.MRM.cmdm:CMDMDataEntry[indexEntryOut].cmdm:Clients.cmdm:Client[indexClientOut].cmdm:ClientIdentifier.cmdm:IdentifierValue =
InputRoot.MRM.eai:Clients.eai:Client[indexClientIn].eai:ClientIdentifier.eai:IdentifierValue;
SET OutputRoot.MRM.cmdm:CMDMDataEntry[indexEntryOut].cmdm:Clients.cmdm:Client[indexClientOut].cmdm:ClientIdentifier.cmdm:IdentifierType =
UPPER(SUBSTRING(InputRoot.MRM.eai:Clients.eai:Client[indexClientIn].eai:ClientIdentifier.eai:IdentifierType FROM 1 FOR 10));
|
|
|
Back to top |
|
 |
TonyD |
Posted: Sun Jun 12, 2005 10:47 pm Post subject: Solved! |
|
|
Knight
Joined: 15 May 2001 Posts: 540 Location: New Zealand
|
'ClientIdentifier' in the inbound message schema was defined as 'maxOccurs=1' and in the outbound message schema as 'maxOccurs=unbounded'. Altering the inbound one to 'unbounded' also and mapping between the arrays fixed the problem. |
|
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
|
|
|
|