XML parsing

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
shrey3a
Premium Member
Premium Member
Posts: 234
Joined: Sun Nov 21, 2004 10:41 pm

XML parsing

Post by shrey3a »

Gurus,

Is there a way to parse XML tag from xml message i.e. without removing the tags.

<msg <othertags
<insert <col>........ </insert>
<insert <col>........ </insert>
<insert <col>........ </insert>
<insert <col>........ </insert>
</other tgs></msg>

I need o/p as
<insert <col>........ </insert>
<insert <col>........ </insert>

I need to use the XML stage as I'm parsing some other tags in same message but need to take insert tag as it is.

Regards,
Munish
throbinson
Charter Member
Charter Member
Posts: 299
Joined: Wed Nov 13, 2002 5:38 pm
Location: USA

Post by throbinson »

If the "insert" XPATH can be defined then it can be parsed from the rest and output as an xml fragment. In your example you could define a column with this XPATH in the description:
/msg/insert
You will probably need to define it as a repetition element as well which means it will need to have it's own output link from the XMLInput stage. Add the other key fields so that you can tie these inserts with the rest of the message down the road and you're good to go.
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

...it is also likely that you will need patch 117664, which corrected an anomaly with reads of partial xml "chunks". You'll know if you need it if your "insert" set of tags gets parsed out of the larger document, but no longer has it's tag characters (< and />). ...also, I've noticed that sometimes I need the final "/" --- so add that to the xpath above if you have problems.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
shrey3a
Premium Member
Premium Member
Posts: 234
Joined: Sun Nov 21, 2004 10:41 pm

Post by shrey3a »

Hi,

Its the same problem...i have now one element in o/p link put the tags are getting removed...I wanted to retain the tags as it is

Peek_333,0: INSERT:192200905USAAO2008-06-20T19:49:46.0000002008-06-30T11:27:09.000000^ ^ 1996-05-01^ ^6 ^EMPE



Regards,
shrey3a
Premium Member
Premium Member
Posts: 234
Joined: Sun Nov 21, 2004 10:41 pm

Post by shrey3a »

Thanks a lot Ernie...we got the patch from IBM and its working as expected.

Thanks again.

Rgds,
Post Reply