Author |
Message
|
bab |
Posted: Fri Jul 15, 2016 2:18 am Post subject: How to access element name dynamically? |
|
|
Novice
Joined: 05 Jul 2016 Posts: 17
|
Hi i am new to IIB.
I want to get element tag name dynamically. I dont know how to do that.
I am having the following input :
<emp><name>john</name><salary>30000</salary></emp>
In the above input, i want to get the child names of <emp> root tag , ie. name and salary.
Please help me. Thanks in advance... |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Jul 15, 2016 4:08 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
This is an IIB question, so it should hopefully be locked if it's duplicated or moved to the IIB forum if not.
DO NOT TAKE ACTION ON THIS, bab.
The answer to your question is "use reference messages". If you're using ESQL.
Otherwise use the related options in whatever transformation node you're using. _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Jul 15, 2016 5:01 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
mqjeff wrote: |
This is an IIB question, so it should hopefully be locked if it's duplicated or moved to the IIB forum if not.
DO NOT TAKE ACTION ON THIS, bab.
The answer to your question is "use reference messages". If you're using ESQL.
Otherwise use the related options in whatever transformation node you're using. |
Jeff might not have been clear enough:
Use a reference.
ESQL
Code: |
declare xyz REFERENCE TO ....emp;
MOVE xyz FIRSTCHILD TYPE <parsername>.<type>;
SET fname = FIELDNAME(xyz); |
With that you have the base and should be able to find the corresponding references in the infocenter.
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
timber |
Posted: Fri Jul 15, 2016 10:58 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
This (not tested, probably broken) loop will get the name of each first-level child tag of <emp>:
Code: |
DECLARE childRef REFERENCE TO InputRoot.XMLNSC.emp.(XMLNSC.Element)*[1];
WHILE LASTMOVE(xyz) DO
DECLARE fname FIELDNAME(childRef);
-- Do something with fname. But what?!
MOVE childRef NEXTSIBLING;
END IF; |
However, it seems like a strange requirement for a message flow. What problem are you trying to solve? |
|
Back to top |
|
 |
bab |
Posted: Thu Aug 04, 2016 3:22 am Post subject: Thanks for all your replies. |
|
|
Novice
Joined: 05 Jul 2016 Posts: 17
|
Thanks for all your replies. |
|
Back to top |
|
 |
|