XML Output stage

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
kennyapril
Participant
Posts: 248
Joined: Fri Jul 30, 2010 9:04 am

XML Output stage

Post by kennyapril »

Trying to compose XML file with records. I use XML output stage and imported the definition as well. To include the parent tags, I just added them in the transformer and other columns are imported.Also gave / in the declaration for the XML field name.

I do not see any error or warning but no XML file is created. Please suggest me if any changes are required.

Thank you!
Regards,
Kenny
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Not enough detail to suggest what might be the issue. Check to make sure all the rows are getting into the xmlOutput Stage and aren't being dropped or otherwise filtered out earlier...

....also try putting a Sequential Stage AFTER the XML Stage and use the Sequential Stage to do the I/O. Put one large column on the output link with Delimiter NONE and quote character NONE. Put a single "/" in its Description.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
kennyapril
Participant
Posts: 248
Joined: Fri Jul 30, 2010 9:04 am

Post by kennyapril »

Thank you Ernie.
I did not see the record flow in the job from XML output stage but looks like XML files are created but I see that each record has created a file.As there are 20 records 20 files are created.

Any setting needs to be changed?
Regards,
Kenny
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

If you enabled the 'Trigger Column' option, turn that off.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kennyapril
Participant
Posts: 248
Joined: Fri Jul 30, 2010 9:04 am

Post by kennyapril »

If it is about output tab---->Transformation settings--->outputmode---> I selected single row.

Please let me know if its some other setting....thank you!
Regards,
Kenny
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

99.999 % of the time, you will want "aggregate" as that option --- which basically means "take all my rows and put them into a single xml document...with multiple nodes for multiple rows" (depending of course, on their organization and hierarchy).

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
kennyapril
Participant
Posts: 248
Joined: Fri Jul 30, 2010 9:04 am

Post by kennyapril »

I changed it to Aggregate button and all the data came into a Single XML file but all the tags came into one child tags like below

<Parent>
<child>
<userID>123</userID>
<userID>123</userID>
<userID>123</userID>
<userID>123</userID>
<userID>123</userID>
<Phone>6436431347</Phone>
<Fax>5654345678</Fax>
<Addr>123<Addr>
<City>Sunnyvale</City>
<State>CA</State>
</child>
</Parent>

These should be 5 different child tags but came into one child tag, just an FYI the key is same for all the tags.

Thank you
Regards,
Kenny
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Yes. Have seen that before with tiny nodes and no unique cols. Try adding another dummy column on the link, with its own dummy element name in the xpath, at the same level as this child. Make it the key instead, and give it a unique counter value in a transformer upstream.

First just to test if that's the issue.

If it works, see if the receiving application cares --- it may not unless it is validating. If so, edit out the dummy element downstream.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
kennyapril
Participant
Posts: 248
Joined: Fri Jul 30, 2010 9:04 am

Post by kennyapril »

I did the below changes, Added a new column which says ID and generated sequence number for it but still I see the same pattern. Only change is the ID is repeated now and rest all same just once.

thank you
Regards,
Kenny
kennyapril
Participant
Posts: 248
Joined: Fri Jul 30, 2010 9:04 am

Post by kennyapril »

I think I tried a different way, just included a new column.
Now I added an other column at the CHILD level giving it a sequence and I see the data in the below way which is not in correct format

<Parent>
<child>
<newchild>1
<userID>123</userID>
<Phone>6436431347</Phone>
<Fax>5654345678</Fax>
<Addr>123<Addr>
<City>Sunnyvale</City>
<State>CA</State>
<newchild>
</child>
<child>
<newchild>2
<userID>123</userID>
<Phone>6436431347</Phone>
<Fax>5654345678</Fax>
<Addr>123<Addr>
<City>Sunnyvale</City>
<State>CA</State>
<newchild>
</child>
<child>
<newchild>3
<userID>123</userID>
<Phone>6436431347</Phone>
<Fax>5654345678</Fax>
<Addr>123<Addr>
<City>Sunnyvale</City>
<State>CA</State>
<newchild>
</child>
</Parent>
Regards,
Kenny
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Share the exact xpath for these columns. (What is in the Desc property of the output link)
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
kennyapril
Participant
Posts: 248
Joined: Fri Jul 30, 2010 9:04 am

Post by kennyapril »

This is the original XML seen in my table which should be for 5 transactions
<?xml version="1.0" encoding="UTF-8"?>
<TRANSACTIONS>
<I_TRAN>
<TRANSACTION_ID>123 </TRANSACTION_ID>
<TRANSACTION_ID> 123 </TRANSACTION_ID>
<TRANSACTION_ID> 123 </TRANSACTION_ID>
<TRANSACTION_ID> 123</TRANSACTION_ID>
<TRANSACTION_ID> 123 </TRANSACTION_ID>
<ENTITY> 78 </ENTITY>
<IM_ACCOUNT> 132 </IM_ACCOUNT>
<DR_CR_AMT> 45.549999237060547 </DR_CR_AMT>
<CHECK_NO> 4533 </CHECK_NO>
</I_TRAN>
</TRANSACTIONS>


This is the column in the XML output stage output column
XML_OUTPUT stage output column TRAN_CLOB length:-99999999 DataType:-LongVarchar Description:- /

Xpath for the five columns
/TRANSACTIONS/I_TRAN/TRANSACTION_ID/text()
/TRANSACTIONS/I_TRAN/ENTITY/text()
/TRANSACTIONS/I_TRAN/IM_ACCOUNT/text()
/TRANSACTIONS/I_TRAN/DR_CR_AMT/text()
/TRANSACTIONS/I_TRAN/CHECK_NO/text()



Also just an FYI I had these 5 columns coming from my table before XML_Output stage but I need to add the parent and child so in the transformer I defined two new columns
one is TRANSACTIONS and other I_TRAN for which I gave ' ' in the column value and passes to the XML_output stage


Please let me know if anything above needs to be changed, thank you!
Regards,
Kenny
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Need to also see "newchild" and its xpath.
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
kennyapril
Participant
Posts: 248
Joined: Fri Jul 30, 2010 9:04 am

Post by kennyapril »

It worked now. I gave '****' for I_TRAN in the transformer before XML_output stage and after XML output I used an other transformer to replace '****' with '' and it worked as required. All records in separate tags.

Thank you very much!
Regards,
Kenny
Post Reply