Author |
Message
|
bhavyabhandari |
Posted: Thu Dec 06, 2007 7:00 am Post subject: Setting attribute in MRM domain |
|
|
Apprentice
Joined: 09 Nov 2006 Posts: 33
|
How can we set an attribute to an Element in the MRM domain using esql. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Dec 06, 2007 7:12 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
By modelling the field in MRM to have a physical representation of an Attribute, rather than as an Element. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Dec 06, 2007 7:26 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
A lot of people get confused by this.
In the XML, XMLNS and XMLNSC domains, you indicate that a syntax element is an attribute by setting the 'TYPE' field to XML.Attribute or XMLNSC.Attribute.
In the MRM domain, the MRM parser works out whether it is an attribute by matching the message tree against the message model. If you want something to be an element in your output XML, it must be an element in your output message definition ( i.e. message type ). |
|
Back to top |
|
 |
bhavyabhandari |
Posted: Thu Dec 06, 2007 11:03 am Post subject: re:setting the attribute |
|
|
Apprentice
Joined: 09 Nov 2006 Posts: 33
|
I have the message set in the MRM domain ,,
and i want my output to be
<PaythruBank Type='s'></PaythruBank>
How will I able to set the value of the Attribute 'Type' to value 's' |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Dec 06, 2007 11:08 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
By assigning 's' to be the value of the field that represents Type.
This is done using SET, in ESQL.
And, to repeat what Kimbert just said - with MRM you *do not* use any qualifiers on the ESQL to indicate that a field is an Element or an Attribute. You just reference the field by name&namespace. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
bhavyabhandari |
Posted: Thu Dec 06, 2007 11:17 am Post subject: |
|
|
Apprentice
Joined: 09 Nov 2006 Posts: 33
|
In MRM I have tried to code it as
PaythruBank.Type = S';
But its not setting the value..
could u suggest any alternative' |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Dec 06, 2007 11:21 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Why isn't it setting the value?
What value is it setting?
What error is it returning?
Also, your code should be more like
SET OutputRoot.MRM.<something>.PaythruBank.Type = 'S';
Where "<something>" is replaced by whatever exists between the XML root and the PaythruBank element.
And you may need to include namespace qualifiers at various points, too. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
bhavyabhandari |
Posted: Thu Dec 06, 2007 11:25 am Post subject: |
|
|
Apprentice
Joined: 09 Nov 2006 Posts: 33
|
I have coded in the same way..set the Msg Set domein to MRM..
but the Type value is not coming
<PaythruBank> |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Dec 06, 2007 11:34 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
There's all kinds of reasons why this could not be taking the value.
Did you set your Compute node's Compute Mode to allow you to edit the message?
Did you use the right namespaces, etc.?
Did you set the value to a constant, i.e. 'S', or is it set to the value of another element?
Is the value set after the node, but not on output from the flow? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
bhavyabhandari |
Posted: Thu Dec 06, 2007 11:56 am Post subject: |
|
|
Apprentice
Joined: 09 Nov 2006 Posts: 33
|
The Attribute value is not being set nor does it come in the debug.
I have tried by using the coding technique and also thru the XMLElementAttr value in the Message Set |
|
Back to top |
|
 |
kimbert |
Posted: Thu Dec 06, 2007 2:21 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
bhavyabhandari : you are not helping us to diagnose your problem, and you sound like somebody who is struggling with the basics.
I suggest that you stop working on the original problem, and try this simple exercise:
1. Create a new message set with one physical format ( XML1 )
2. Create message1 and message2 in the new message set
3. Right-click message1 and 'Add local element', producing 'element1'
4. Right-click message2 and 'Add local attribute', producing 'attr1'
5. Create a message flow consisting of MQInput->Compute->MQOutput
6. Set MQInput node to use the new message set, with message type set to 'message1' and message format set to 'XML1'
7. In the Compute node, write the following:
Code: |
SET OutputRoot.Properties.MessageType = 'message2';
SET OutputRoot.MRM.attr1 = InputRoot.MRM.element1; |
Deploy the resulting message flow, and watch what happens. If your input message is
Code: |
<message1><element1>value</element1></message1> |
then you should see that the output message is
Code: |
<message 2 attr1='value'/> |
If you understand everything that I have said, you should be able to solve your problem by yourself ( or at least describe the problem in a more helpful way )
If you don't understand the above steps, you need to get some training on WMB. |
|
Back to top |
|
 |
|