Author |
Message
|
coolguynit |
Posted: Tue Jul 12, 2011 3:56 am Post subject: accessing multiple root elements |
|
|
Newbie
Joined: 12 Jul 2011 Posts: 3
|
how to traverse A xml message with multiple root elements using for loop in EQL |
|
Back to top |
|
 |
smdavies99 |
Posted: Tue Jul 12, 2011 4:06 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
A valid XML document can only have one root element.
Can you give us and example of the type of data you are looking at? _________________ 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 |
|
 |
coolguynit |
Posted: Tue Jul 12, 2011 4:30 am Post subject: in this XML rec is occuring twice soi have traverse this rec |
|
|
Newbie
Joined: 12 Jul 2011 Posts: 3
|
<Detail>
<rec>
<Name>nitin</Name>
<Empid>636</Empid>
<Profile>ASE</Profile>
</rec>
<rec>
<Name>amit</Name>
<Empid>637</Empid>
<Profile>ASE</Profile>
</rec>
</Detail> |
|
Back to top |
|
 |
Vitor |
Posted: Tue Jul 12, 2011 4:47 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
That's not a document with multiple root elements. In the quoted example Detail is the root element.
And you'd traverse the child rec elements with a WHILE or a FOR loop.
This is ESQL 101 and I won't steal the thunder of others about training except to say that if you need to ask a question this basic you either need training or you need the money you paid for training refunded.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
coolguynit |
Posted: Tue Jul 12, 2011 5:00 am Post subject: hw we can traverse?? |
|
|
Newbie
Joined: 12 Jul 2011 Posts: 3
|
Thanks for the reply .......Can you please help me I am nt getting hw to traverse this using for or while loop?? |
|
Back to top |
|
 |
Vitor |
Posted: Tue Jul 12, 2011 5:15 am Post subject: Re: hw we can traverse?? |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
coolguynit wrote: |
Can you please help me I am nt getting hw to traverse this using for or while loop?? |
I repeat my comments about training.
This forum is not a training resource.
Having reviewed the documentation for these 2 constructs what don't you "get"? What happens when you try it?
Have you considered using a Mapping node's drag-and-drop functionality? If the XML is as simple as your example (and yes, I'm being deliberately evasive because XML that simple occurs in certification questions) that could be an answer until you've increased ESQL skills. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
rglack10 |
Posted: Tue Jul 12, 2011 8:04 am Post subject: Re: hw we can traverse?? |
|
|
Apprentice
Joined: 06 Jul 2011 Posts: 34
|
coolguynit wrote: |
Thanks for the reply .......Can you please help me I am nt getting hw to traverse this using for or while loop?? |
If you're really at this level that you're asking this type of stuff then giving you the answer will only lead to more questions until someone is as well doing the solution for you and that's the wrong way to go about it.
Have you thought about using the help menu to search for WHILE.. FOR etc and see what comes up? Are you familiar with the info centre?
Also try importing some of the samples and viewing the ESQL etc. |
|
Back to top |
|
 |
|