Author |
Message
|
Paul D |
Posted: Wed Mar 31, 2004 1:48 pm Post subject: Setting XML Attribute in Msg Set in MB v5 [SOLVED] |
|
|
 Master
Joined: 16 May 2001 Posts: 200 Location: Green Bay Packer Country
|
Is it possible to set an XML attribute in a message set? I know the ESQL method, but would rather set this in my msg set itself. I'm not mapping the value of it from anywhere, I want to assign it to this tag in the message set. My map will populate the tag value. Any ideas?
Thanks in advance!!!
Paul _________________ Thanks!!!
Paul D
Last edited by Paul D on Thu Apr 01, 2004 12:24 pm; edited 1 time in total |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Mar 31, 2004 8:01 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Yeah. Assign a default value... _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
wooda |
Posted: Thu Apr 01, 2004 12:08 am Post subject: |
|
|
 Master
Joined: 21 Nov 2003 Posts: 265 Location: UK
|
Quote: |
Yeah. Assign a default value... |
Actually default and fixed values are ignored by MRM XML.
They are only inserted in fixed length formats (eg. CWF or TDS Fixed Length).
So setting the default value wont give you the behaviour you want.
I'm afraid you have to insert the values in ESQL.
(somebody please correct me if I'm wrong, but alas I think I am correct)
[/quote] |
|
Back to top |
|
 |
kimbert |
Posted: Thu Apr 01, 2004 4:48 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
wooda: You are correct. Default values are only applied when writing fixed-length messages.
Quote: |
Is it possible to set an XML attribute in a message set? |
I'm not sure I understand the question. Do you want to output a value as an XML attribute (as opposed to an XML Element)? If so, just model it as an attribute, and the MRM will write it as an attribute (assuming that you set OutputRoot.Properties.MessageType correctly, of course).
Or do you want the MRM to assign a value to an attribute automatically (i.e. a default value)? If so, note the previous post by wooda. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Apr 01, 2004 6:26 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
kimbert wrote: |
wooda: You are correct. Default values are only applied when writing fixed-length messages. |
But, also, . Default values should be enforced in all domains. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Paul D |
Posted: Thu Apr 01, 2004 6:34 am Post subject: |
|
|
 Master
Joined: 16 May 2001 Posts: 200 Location: Green Bay Packer Country
|
I'm trying to do something like this.
Sample XML Tag with attribute
<MsgProtocolVersionNum nml-length='3'>001</MsgProtocolVersionNum>
Here's the ESQL for it:
Set OutputRoot.XML.(XML.tag)TrustPremiumTransaction.(XML.tag)MsgProtocolVersionNum.(XML.attr)"nml-length" = '3';
I want the MRM to default the nml-length attribute for me. _________________ Thanks!!!
Paul D |
|
Back to top |
|
 |
Paul D |
Posted: Thu Apr 01, 2004 12:23 pm Post subject: Setting XML Attribute in Msg Set in MB v5 [SOLVED] |
|
|
 Master
Joined: 16 May 2001 Posts: 200 Location: Green Bay Packer Country
|
Got the solution
Example
<?xml version="1.0">
<SomeRequestMsg xx-type="Structure" xx-version="001">
<MsgProtocol>SCIP</MsgProtocol>
<MsgProtocolVersionNum>001</MsgProtocolVersionNum>
....
Setting XML Attributes in the Msg Set Definition
1 - Open the mxsd editor for the Msg Set.
2 - Right Click on an element and do a “Add Local Attribute”
3 - Enter the name, such as xx-type in to create it.
4 - To default the value of it, highlight it, then click on the properties tab at the bottom of the window. On the right under details, set the default to the value to default this to, such as "Structure".
5 - Repeat steps for the second attribute. _________________ Thanks!!!
Paul D |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Apr 01, 2004 12:32 pm Post subject: Re: Setting XML Attribute in Msg Set in MB v5 [SOLVED] |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Paul Dix wrote: |
Got the solution |
Have you verified that this value is actually populated when the XML is written to a queue?
If that's true, then it contradicts what Kimbert and wooda have said.
But they may have been talking about v2.1, and if you're talking about .mxsd files, then you are talking about v5. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Paul D |
Posted: Thu Apr 01, 2004 12:46 pm Post subject: |
|
|
 Master
Joined: 16 May 2001 Posts: 200 Location: Green Bay Packer Country
|
I'm in the middle of testing this, so I didn't actually see it yet. I talked to IBM support and got this solution. I asked specifically if this was available in 2.1 and they said yes. I didn't ask specifically how to set in under 2.1's MRM editor though. _________________ Thanks!!!
Paul D |
|
Back to top |
|
 |
wooda |
Posted: Fri Apr 02, 2004 12:10 am Post subject: |
|
|
 Master
Joined: 21 Nov 2003 Posts: 265 Location: UK
|
Paul -
Please let us know your findings.
But I can predict now that the attributes will not be populated with default values even in v5. |
|
Back to top |
|
 |
Paul D |
Posted: Fri Apr 02, 2004 5:57 am Post subject: |
|
|
 Master
Joined: 16 May 2001 Posts: 200 Location: Green Bay Packer Country
|
The developers from the project I support solved it this way:
We added these local attributes and since we are using a mapper node, we just set the attribute for nml-length by creating a one sided mapping to the appropriate value.
They did test this and it works fine. I'm in the middle of other more pressing issues, so I have not confirmed my default method yet. _________________ Thanks!!!
Paul D |
|
Back to top |
|
 |
|