Author |
Message
|
vasanthi |
Posted: Tue Jul 12, 2005 4:56 pm Post subject: xml to xml mapping using mapping node |
|
|
Apprentice
Joined: 23 Apr 2005 Posts: 42
|
HI
i have a small problem on my hand which i am trying to solve using the mapping node.the definition of the problem is i have created a message set by importing an xsd.the message domain is MRM and the format is xml.i have to map some of the fields in the message set and generate an output xml.i don't have a message set for output.
here i am giving my sample input xml message and the output xml message which i should generate.
input xml message
<list1>
<ns10:Loc>
<ns10:key>1000</ns10:key>
<ns10:id>100</ns10:id>
<ns10:districtNumber>0</ns10:districtNumber>
<ns10:regionNumber>0</ns10:regionNumber>
<ns10:cityName>MONTGOMERY</ns10:cityName>
<ns10:stateCode>NY</ns10:stateCode>
<ns10:countryCode>USA</ns10:countryCode>
<ns10:postalCode>12549</ns10:postalCode>
</ns10:Loc>
<list1>
and the output xml message should be
<transaction NAME="update">
- <object OF_TYPE="Loc">
<field NAME="address">
- <object OF_TYPE="Address">
<field NAME="address1" />
<field NAME="City">PALM BAY</field>
<field NAME="state">FL</field>
<field NAME="postalCode">32905</field>
<field NAME="phone" />
- <field NAME="primaryContact">
- <object OF_TYPE="Contact">
<field NAME="firstName" />
<field NAME="lastName" />
</object>
</field>
</object>
</field>
</object>
</transaction>
there are so many other tags in the input xml but i am giving just a small part of it.
so as in the example we have the state code, citycode,postal code and so on.so i need to map them using a mapping node so that i get this output message.
i was able to do this using in esql. but the code is getting bigger.so i want to know if this can be done using a mapping node.
as you can see there are multiple tags by the name <field> in the output message and each is having and attribute name.so how this can be set.
i will be thankful for those with any ideas on how this can be done. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Jul 13, 2005 3:11 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
|
Back to top |
|
 |
vasanthi |
Posted: Wed Jul 13, 2005 5:56 am Post subject: xml to xml mapping |
|
|
Apprentice
Joined: 23 Apr 2005 Posts: 42
|
Hi jeff
thanks for responding.i have gone through the link but it says that many-to-many mapping is used when dealing with databases.
and also as i have gone through it i could not follow it properly.if possible can you give me an example.
here i am giving a small example of my problem once again
part of the input message
<ns10:cityName>MONTGOMERY</ns10:cityName>
<ns10:stateCode>NY</ns10:stateCode>
<ns10:countryCode>USA</ns10:countryCode>
<ns10:postalCode>12549</ns10:postalCode>
<ns10:fname>aaaa</ns10:fname>
<ns10:lname>bbbb</ns10:lname>
base upon the input above the output should look like
<transaction NAME="update">
- <object OF_TYPE="Loc">
<field NAME="address">
- <object OF_TYPE="Address">
<field NAME="address1" />
<field NAME="City">PALM BAY</field>
<field NAME="state">FL</field>
<field NAME="postalCode">32905</field>
<field NAME="phone" />
- <field NAME="primaryContact">
- <object OF_TYPE="Contact">
<field NAME="firstName" />
<field NAME="lastName" />
</object>
</field>
</object>
</field>
</object>
</transaction>
as you can see that the state code,country code and etc.. from the input message i am mapping to the output.for output i don't have a message set.so how can i design the output for mapping so that i can get this output format.
that is as you can see that there are multiple occurrences of the tags <field> and <object> each having a different attribute values.
i will be thankful if you can give me and idea of how to solve this problem based upon the input i have given and the output i require.
thanks
vasanthi |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Jul 13, 2005 5:59 am Post subject: Re: xml to xml mapping |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
vasanthi wrote: |
.for output i don't have a message set. |
Then you can't use the Mapping node.
Also, there are quite a few other Mapping scenarios right at the link I posted - one to one, one to many, repeating, etc.
With examples. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
vasanthi |
Posted: Fri Jul 15, 2005 6:45 am Post subject: xml to xml mapping |
|
|
Apprentice
Joined: 23 Apr 2005 Posts: 42
|
Hi jeff
thanks for responding.as you have seen the output message.it is containing a repeating tag <field> with unknown number of occurences.and as you can see for each <field> tag there is a different attribute name. so now if i want to create a message set for this how can i do it.i am able to do it in ESQL without using a message set by using
------. ---. ---field[counter].(XML.attr)NAME='aaaa';
but if i want to set all these attribute names for all the <field>tags within the message set itself how can this be done.if there is a solution for this please can you send me an example of how this can be done.
thanks
vasanthi |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Jul 15, 2005 7:01 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
|
Back to top |
|
 |
vasanthi |
Posted: Fri Jul 15, 2005 7:25 am Post subject: xml to xml mapping |
|
|
Apprentice
Joined: 23 Apr 2005 Posts: 42
|
hi jeff
i have gone through the reply. but i could not understand. could you be please more elaborate.
thanks
vasanthi |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Jul 15, 2005 7:33 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
If you have an XML Schema that defines your output message, then just import it to create your message set.
Otherwise, there are other import mechanisms for creating message sets, so you don't have to enter fields manually.
Elements in message sets can be configured to be Repeating elements. This will allow a single definition to match against multiple entries in the input data, and be mapped to multiple output entries in the output data.
You will likely not get much in the way of general purpose training here, and will annoy people by asking for it. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
kspranava |
Posted: Sun Jul 17, 2005 10:15 pm Post subject: XML Transformation node |
|
|
 Centurion
Joined: 27 Apr 2003 Posts: 124
|
Hi Vasanthi,
Why dont u try using XML transformation node ?
Quote: |
Use the XMLTransformation node to transform an XML message to another form of XML message, according to the rules provided by an XSL (eXtensible Stylesheet Language) stylesheet |
Pranava. |
|
Back to top |
|
 |
javaforvivek |
Posted: Fri Jul 22, 2005 1:41 am Post subject: |
|
|
 Master
Joined: 14 Jun 2002 Posts: 282 Location: Pune,India
|
Or just use ESQL to create a new output XML message in a compute node..? _________________ Vivek
------------------------------------------------------
...when you have eliminated the impossible, whatever remains, however improbable, must be the truth. |
|
Back to top |
|
 |
|