|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
How to map repeating XML field in input to non repeating in |
« View previous topic :: View next topic » |
Author |
Message
|
bmccarty |
Posted: Wed Apr 10, 2002 10:46 am Post subject: |
|
|
Apprentice
Joined: 18 Dec 2001 Posts: 43
|
If you have any suggestions on this syntax, I would really appreciate it.
I have an input XML message that is pretty typical and has repeating fields that looks something like this:
<Message>
<Person>
<FirstName>Henry</FirstName>
<LastName>Winkler</LastName>
</Person>
<Person>
<FirstName>The</FirstName>
<LastName>Fonz</LastName>
</Person>
</Message>
The output message (not under my control) can't have repeating tags, each XML tag has to be unique. So it would be something like this:
<Message>
<Person>
<FirstName1>Henry</FirstName1>
<LastName1>Winkler</LastName1>
<FirstName2>The</FirstName2>
<LastName2>Fonz</LastName2>
</Person>
</Message>
What is the ESQL syntax to map these together? For the outputroot thus far I have:
Set.OutputRoot.XML.Message.Person.FirstName1 = InputBody.Message.Person.Firstname[1];
That works fine, but it doesn't pass the second occurence:
Set.OutputRoot.XML.Message.Person.FirstName2 = InputBody.Message.Person.Firstname[2];
Obviously I don't understand something about the way the tree is working, but I am not sure what it is I don't know.
Thanks for the help.
B |
|
Back to top |
|
 |
kirani |
Posted: Wed Apr 10, 2002 12:43 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
your ESQL is not correct. You should try using something like this,
SET OutputRoot.XML.Message.Person.FirstName1 = InputBody.Message.Person[1].FirstName;
SET OutputRoot.XML.Message.Person.LastName1 = InputBody.Message.Person[1].LastName;
.....
SET OutputRoot.XML.Message.Person.FirstNameN = InputBody.Message.Person[N].FirstName;
SET OutputRoot.XML.Message.Person.LastNameN = InputBody.Message.Person[N].LastName;
But this way you are hardcoding your Attribute Names. You should try using some kind of LOOP and generate Attribute names dynamically. You can make use of EVAL function for doing this.
_________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
bmccarty |
Posted: Wed Apr 10, 2002 1:00 pm Post subject: |
|
|
Apprentice
Joined: 18 Dec 2001 Posts: 43
|
Thanks Kiran for the help, I must have hit my head when I got out of bed this morning.
I have it working with static references now, but I am still trying to figure out how to build the output tag names dynamically. I will investigate the EVAL.
Thanks again.
B |
|
Back to top |
|
 |
amigupta1978 |
Posted: Thu Apr 11, 2002 12:30 am Post subject: |
|
|
Centurion
Joined: 22 Jan 2002 Posts: 132 Location: India
|
HI,
Which version of WMQI are u using?? If u are using 2.1 then u can try using Create function of ESQL...From which u can craete dynamic name of siblings and i think will have better performance too.. But its only there in MQSI 2.1
otherwise EVAL is the only other option.
Regards,
Amit
|
|
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
|
|
|
|