Author |
Message
|
sanket |
Posted: Tue Oct 17, 2006 3:04 am Post subject: xml to xml mapping |
|
|
 Newbie
Joined: 02 Jun 2006 Posts: 9 Location: pune
|
Hi,
my flow
mqinput -> mapping -> mqoutput
I want to map my input
like
<DataElements>
<plant>123</plant>
<mat>xyz</mat>
</dataElements>
to output like
<DataElements plant='123' mat='xyz'></DataElements>
How to achive this using mapping node?
Thanks,
Sanket |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Oct 17, 2006 3:17 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
By using the appropriate properties of your message model. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
sanket |
Posted: Tue Oct 17, 2006 3:37 am Post subject: xml to xml mapping |
|
|
 Newbie
Joined: 02 Jun 2006 Posts: 9 Location: pune
|
thanks jeff,
Can you tell us which properties and how? |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Oct 17, 2006 3:41 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
What's the difference between the two messages? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
sanket |
Posted: Tue Oct 17, 2006 3:45 am Post subject: xml to xml mapping |
|
|
 Newbie
Joined: 02 Jun 2006 Posts: 9 Location: pune
|
we want output as attribute where as my input is elements. |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Oct 17, 2006 4:00 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
So, which property of the MRM-XML controls how a field in the logical tree is output? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
kimbert |
Posted: Tue Oct 17, 2006 4:13 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
You have two options:
1. Create two message definitions in your message set. One of them defines the fields as elements. The other defines them as attributes. Use the mapping node to map the first onto the second.
2. Define a single message definition, but add two XML physical formats to your message set. In the first, set the XML Render to 'Element'. In the second, set it to 'Attribute'.
1. is the recommended approach these days. |
|
Back to top |
|
 |
sanket |
Posted: Wed Oct 18, 2006 1:18 am Post subject: |
|
|
 Newbie
Joined: 02 Jun 2006 Posts: 9 Location: pune
|
I tried option 1. but still output is as element.
what am i missing?....  |
|
Back to top |
|
 |
kimbert |
Posted: Wed Oct 18, 2006 2:54 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Is the 'Runtime Parser' property of your message set the same as the 'Domain' property of your input node? You should set both of these to 'XMLNSC' unless you need really need MRM features (e.g. validation) for your message flow. |
|
Back to top |
|
 |
sanket |
Posted: Wed Oct 18, 2006 3:26 am Post subject: |
|
|
 Newbie
Joined: 02 Jun 2006 Posts: 9 Location: pune
|
both are set to 'MRM'...
I think i have not done a good job while creating message set definition.
can you send me some example that have mapped elements to attributes ? |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Oct 18, 2006 3:31 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Create a basic XSD for your input message. The one that the WMBT will create for you from any XML document is fine for these purposes.
Import this XSD twice into new message files. Leave one alone. Change the Render property on the other one for the elements that you want to be attributes. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
sasmita10 |
Posted: Fri Oct 20, 2006 12:23 pm Post subject: Simple Solution |
|
|
 Novice
Joined: 23 Feb 2005 Posts: 24 Location: Danbury, CT
|
Set OutputRoot.XML.DataElements.(XML.attr)Plant = InputRoot.XML.DataElements.Plant;
Set OutputRoot.XML.DataElements.(XML.attr)Mat = InputRoot.XML.DataElements.Mat;
-Sasmita _________________ WMQ and WMQI specialist
(IBM Certified Web Sphere MQSeries 6.0 System Administrator )
(IBM Certified Web Sphere Message Broker 6.1 System Administrator ) |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Oct 20, 2006 1:23 pm Post subject: Re: Simple Solution |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
sasmita10 wrote: |
Set OutputRoot.XML.DataElements.(XML.attr)Plant = InputRoot.XML.DataElements.Plant;
Set OutputRoot.XML.DataElements.(XML.attr)Mat = InputRoot.XML.DataElements.Mat;
-Sasmita |
A) How is sanket supposed to code that in the mapping node?
B) Please don't use the XML parser. It's deprecated. Use XMLNS or XMLNSC.
The equivalent to your code would be
Code: |
Set OutputRoot.XMLNSC.DataElements.(XMLNSC.Attribute)Plant = InputRoot.XMLNSC.DataElements.Plant |
_________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
sanket |
Posted: Wed Oct 25, 2006 2:14 am Post subject: |
|
|
 Newbie
Joined: 02 Jun 2006 Posts: 9 Location: pune
|
|
Back to top |
|
 |
|