|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
MRM: set an XML attribute as Repeat Reference? |
« View previous topic :: View next topic » |
Author |
Message
|
lfrestrepog |
Posted: Tue Jul 14, 2015 4:26 am Post subject: MRM: set an XML attribute as Repeat Reference? |
|
|
Novice
Joined: 08 Jul 2014 Posts: 22
|
Hello everyone.
We're using message broker version 7.0.0.7 (sort of context)
We're working with a fixed length structured message wich we need to transform to XML and back to text after some processing; we intend to use an MRM messsage set, with XML and CWF physical formats, to handle that message...
The XML response message, which is to be transformed to text, has one complex element with unbounded maximum occurences. Here's a sample of what the XML document looks like:
Code: |
<client>
<name>not relevant...</name>
<factors>
<factor>
<lastUpdate>yyyy-MM-dd</lastUpdate>
<status>1</status>
</factor>
<factor>
<lastUpdate>yyyy-MM-dd</lastUpdate>
<status>1</status>
</factor>
<factor>
<lastUpdate>yyyy-MM-dd</lastUpdate>
<status>1</status>
</factor>
</factors>
</client>
|
I understand we must create a previous element in the message set to be the "repeat reference". In order to accomodate the repeat reference we introduced an attribute, the "compatible" XML document looks like this:
Code: |
<client>
<name>not relevant...</name>
<factors count="3">
<factor>
<lastUpdate>yyyy-MM-dd</lastUpdate>
<status>1</status>
</factor>
<factor>
<lastUpdate>yyyy-MM-dd</lastUpdate>
<status>1</status>
</factor>
<factor>
<lastUpdate>yyyy-MM-dd</lastUpdate>
<status>1</status>
</factor>
</factors>
</client>
|
That "count" attribute is modeled as a local attribute, with optional usage, and the "factor" is a local element; both of them children of "factor". It seems to be a neat solution.
All looking good so far... But turns out an attribute cannot be a repeat reference, no matter where in the message we place it. So I tried defining it as a local element and render as XMLAttribute, but the toolkit warns it could cause validation issues.
Am I missing something here? I'd like to know if there is any good reason for an attribute not to be a repeat reference... And of course I'd like to receive sugestions for alternatives.
Any comment would be much appreciated.
Thanks! _________________ --
Luis Fernando Restrepo Gutiérrez |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Jul 14, 2015 4:34 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
You do realize of course that version 7.0.0.7 will be out of support end of September?!
Move to IIB10.0.1, modell with DFDL and all will be much easier. _________________ MQ & Broker admin |
|
Back to top |
|
 |
lfrestrepog |
Posted: Tue Jul 14, 2015 7:10 am Post subject: |
|
|
Novice
Joined: 08 Jul 2014 Posts: 22
|
Hi fjb_saper.
Actually I was not aware of that, thanks for the heads up. Unfortunately I'm not in a position to decide about such migration (I'll certainly mention it anyway).
On the other hand, should I then understand there is no alternative way to work this out with version 7?
Regards. _________________ --
Luis Fernando Restrepo Gutiérrez |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Jul 14, 2015 8:24 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
lfrestrepog wrote: |
Hi fjb_saper.
Actually I was not aware of that, thanks for the heads up. Unfortunately I'm not in a position to decide about such migration (I'll certainly mention it anyway).
On the other hand, should I then understand there is no alternative way to work this out with version 7?
Regards. |
There may be but you should not spend any time on it because with Version 8 and above (current one is IIB10) you would be modelling this with DFDL (and it would be much easier to do so.)  _________________ MQ & Broker admin |
|
Back to top |
|
 |
kimbert |
Posted: Tue Jul 14, 2015 12:17 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
That "count" attribute is modeled as a local attribute, with optional usage, and the "factor" is a local element; both of them children of "factor". It seems to be a neat solution.
All looking good so far... But turns out an attribute cannot be a repeat reference, no matter where in the message we place it. So I tried defining it as a local element and render as XMLAttribute, but the toolkit warns it could cause validation issues. |
I agree with everything that fjb_saper has said.
In addition to that, you are missing an obvious simplification. Who said that you need to create an XML document in order to create your 'count' field? The MRM ( or DFDL ) parser only cares about the contents of the message tree. So just use
Code: |
CREATE FIRSTCHILD OF OutputRoot.MRM Type Name Name 'count'; |
(not tested, buy hopefully you get the idea ).
But don't use MRM - upgrade to v10, use DFDL, and make your life a *lot* easier. _________________ 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 |
|
 |
lfrestrepog |
Posted: Fri Jul 24, 2015 1:14 am Post subject: |
|
|
Novice
Joined: 08 Jul 2014 Posts: 22
|
Hello.
Thanks for your replies. We'll be migrating to IIB9 or IIB10 (not yet sure which one, but it would be better anyway). In the mean time we're implementing a workaround based on the suggestion by kimbert.
Regards. _________________ --
Luis Fernando Restrepo Gutiérrez |
|
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
|
|
|
|