XML parsing...removal of parent element

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
ag_ram
Premium Member
Premium Member
Posts: 524
Joined: Wed Feb 28, 2007 3:51 am

XML parsing...removal of parent element

Post by ag_ram »

Hi

Scenario: I am generating a XML chunk as below


My job looks like this...


DS
|
\|/
transformer
|
\|/
XMLputput1
|
Lookup --->XMLputput3
/|\
|
transformer
/|\
|
XMLoutput2
/|\
|
DS

XMloutput 1: header XML
XMLoutput 2: Chunk XML generation
XMLoutput :Final XML generation

<Order> <LineItem> <a> <b> <c> </LineItem>
<LineItem> <a> <b> <c> </LineItem>
<LineItem> <a> <b> <c> </LineItem>
<Order>

After this chunk is generated, in the same job I want the output as below


<LineItem> <a> <b> <c> </LineItem>
<LineItem> <a> <b> <c> </LineItem>
<LineItem> <a> <b> <c> </LineItem>

In the Xmloutput2 I generate the chunk as above. ( I should have Order element as I need to group the LineItems based on trigger set in XML)
But in final XML generation I should not have Order element.

I hope I made my point clear. Is it possible?

Sorry I have no idea of drawing job diagram in this DSxchange post.

Regards
Last edited by ag_ram on Wed Jan 02, 2008 3:31 pm, edited 1 time in total.
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Not sure where/how you are creating the lineitem chunk....if it's as purely relational as it looks, I'd just create it earlier, from whatever the row source is....but your other option is to send the whole XML to another XMLInput Stage, with a single column, key=yes, and Description attribute of /Order/LineItem/ ...you will get as many rows as there are line item elements...then use any manner of DataStage techniques to push them together again..... of course it might be simpler to just pull the column using /Order/ and then pass the string thru a transformer that zaps out <order> and </order> using one of the string functions.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Post Reply