Page 1 of 1

XML Output stage

Posted: Wed Jan 08, 2014 7:44 pm
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!

Posted: Wed Jan 08, 2014 10:23 pm
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

Posted: Thu Jan 09, 2014 11:00 am
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?

Posted: Thu Jan 09, 2014 11:10 am
by chulett
If you enabled the 'Trigger Column' option, turn that off.

Posted: Thu Jan 09, 2014 12:02 pm
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!

Posted: Thu Jan 09, 2014 12:53 pm
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

Posted: Thu Jan 09, 2014 3:48 pm
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

Posted: Thu Jan 09, 2014 8:22 pm
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

Posted: Fri Jan 10, 2014 11:56 am
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

Posted: Fri Jan 10, 2014 3:05 pm
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>

Posted: Sat Jan 11, 2014 9:51 pm
by eostic
Share the exact xpath for these columns. (What is in the Desc property of the output link)

Posted: Sat Jan 11, 2014 10:43 pm
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!

Posted: Sun Jan 12, 2014 12:59 pm
by eostic
Need to also see "newchild" and its xpath.

Posted: Mon Jan 13, 2014 11:46 pm
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!