Author |
Message
|
raana |
Posted: Sun Jan 15, 2017 10:58 pm Post subject: XML Creation using ESQL |
|
|
Newbie
Joined: 15 Jan 2017 Posts: 6
|
I am an novice IIB developer. Can someone guide me in creating the below xml structure using ESQL.
Input:
<animal>
<animaldomestic>dog<animaldomestic>
<animalwild>cheetah<animalwild>
</animal>
Output:
<animals>
<animal type="domestic">cow</animal>
<animal type="wild">cheetah</animal>
</animals> |
|
Back to top |
|
 |
smdavies99 |
Posted: Sun Jan 15, 2017 11:14 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Welcome to this forum.
We do have some rules though.
1) We don't do your job for you. We provide help.
2) We are not a resource you can rely on for a timely response. most of us have our own jobs to do as well.
3) We are not a substitute for getting proper training.
4) WE really appreciate YOU trying things out and helping yourself.
The answer to your problem is available in one or more of the following
1) The samples provided with the Product
2) The product documentation
3) This forum.
Enjoy _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
Deepak.k |
Posted: Sun Jan 15, 2017 11:14 pm Post subject: Hi raana |
|
|
Novice
Joined: 18 Aug 2016 Posts: 22
|
|
Back to top |
|
 |
raana |
Posted: Mon Jan 16, 2017 12:21 am Post subject: |
|
|
Newbie
Joined: 15 Jan 2017 Posts: 6
|
Thank you deepak.
I have tried the below code:
SET OutputRoot.XMLNSC.animals.animal.(XMLNSC.Attribute)type = 'domestic';
SET OutputRoot.XMLNSC.animals.animal VALUE = InputRoot.XMLNSC.animal.animaldomestic;
SET OutputRoot.XMLNSC.animals.animal.(XMLNSC.Attribute)type = 'wild';
SET OutputRoot.XMLNSC.animals.animal VALUE = InputRoot.XMLNSC.animal.animalwild;
but i got only the below:
<animals>
<animal type="domestic">cow</animal>
<animals>
Last edited by raana on Mon Jan 16, 2017 2:44 am; edited 2 times in total |
|
Back to top |
|
 |
raana |
Posted: Mon Jan 16, 2017 12:30 am Post subject: |
|
|
Newbie
Joined: 15 Jan 2017 Posts: 6
|
Thank you guys. I got the desired output. |
|
Back to top |
|
 |
smdavies99 |
Posted: Mon Jan 16, 2017 2:28 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Great. Well done.
Why not share the working code so that others can benefit from your learning? _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
raana |
Posted: Mon Jan 16, 2017 2:32 am Post subject: |
|
|
Newbie
Joined: 15 Jan 2017 Posts: 6
|
Sure davis!!
SET OutputRoot.XMLNSC.animals.animal[1].(XMLNSC.Attribute)type = 'domestic';
SET OutputRoot.XMLNSC.animals.animal[1]VALUE = InputRoot.XMLNSC.animal.animaldomestic;
SET OutputRoot.XMLNSC.animals.animal[2].(XMLNSC.Attribute)type = 'wild';
SET OutputRoot.XMLNSC.animals.animal[2]VALUE = InputRoot.XMLNSC.animal.animalwild; |
|
Back to top |
|
 |
smdavies99 |
Posted: Mon Jan 16, 2017 7:48 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Your next lesson should be how to make the code more efficient.
Using indexes beyong 1 or 2 is very inneficient. Also making use of references would help.
Learning to use the formatting options on the bar above the edit box would be useful.
Here is your code inside C O D E tags
Code: |
SET OutputRoot.XMLNSC.animals.animal[1].(XMLNSC.Attribute)type = 'domestic';
SET OutputRoot.XMLNSC.animals.animal[1]VALUE = InputRoot.XMLNSC.animal.animaldomestic;
SET OutputRoot.XMLNSC.animals.animal[2].(XMLNSC.Attribute)type = 'wild';
SET OutputRoot.XMLNSC.animals.animal[2]VALUE = InputRoot.XMLNSC.animal.animalwild;
|
Finally, it is DAVIES not DAVIS. They are two different family names. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
|