Page 1 of 1

XML Output

Posted: Wed Dec 04, 2013 5:14 pm
by bond88
Hi,
I am working on java integration and for that I need to pass XML data. I am using XML output to get XML format from oracle table data. If I am passing duplicate rows I am getting only one row (first tag is repeating). Please take a look at below output format. I need 3 rows separately. Please advise me.

Input:

Title -- Initials
Student Assistant -- F
Student Assistant -- F
Student Assistant -- F

Output:

-<users>
-<user>
<title> Student Assistant </title>
<title> Student Assistant </title>
<title> Student Assistant </title>
<initials> F </initials>
</user>
</users>

Posted: Wed Dec 04, 2013 7:07 pm
by chulett
Post your XPath Expressions.

Posted: Wed Dec 04, 2013 9:15 pm
by eostic
Try adding a unique counter as another column just before title. You can remove it later.

Posted: Wed Dec 04, 2013 10:49 pm
by chulett
... or that. :wink:

Posted: Thu Dec 05, 2013 10:29 am
by bond88
I added an extra field "Num" (using surrogate key generator) to that then it started returning output like this.

Input:

Num -- Title -- Initials
61 -- Student Assistant -- F
62 -- Student Assistant -- F
63 -- Student Assistant -- F

Output:

-<users>
-<user>
<num> 61 </num>
<num> 62 </num>
<num> 63 </num>
<title> Student Assistant </title>
<initials> F </initials>
</user>
</users>

Please advise me.

Thank you,

Posted: Thu Dec 05, 2013 10:31 am
by bond88
I am using following expression to create XML

/import-users-request/users/user/num
/import-users-request/users/user/title
/import-users-request/users/user/initials

Thank you,

Posted: Thu Dec 05, 2013 12:35 pm
by eostic
check your xpath. make sure each one ends with "text()"

Like:

/import-users-request/users/user/num/text()

and then also check that you are using "aggregate" on the detail tab of the output link and make num your only "key".

We'll assume also that the rows are arriving in this exact order (ie...for this test, don't have a multi-node config or anything else that might confuse the issue)

Ernie

Posted: Thu Dec 05, 2013 3:00 pm
by bond88
Thanks Ernie,
I added /text() to all 3 columns (descriptions) and I am using aggregate on the detail tab, I made num as key and not running any nodes I am running under sequential mode but still getting the output in the old way. Please suggest me.

Thank you,

Posted: Thu Dec 05, 2013 7:22 pm
by eostic
At the moment I am not sure and right now I don't have access to DataStage to try anything.......I recall a very strange behavior from many years ago where fewer than 4 columns created some issues. As a test that wouldn't be too hard to try, add two more cols and see if it impacts anything (add num1 and num2, with equivalent xpath for a total of 5 cols). It might do nothing or might hint at what the issue is.

Ernie

Posted: Thu Dec 05, 2013 8:07 pm
by bond88
Thanks Ernie,
To debug I was trying with fewer columns. So I added all the required 12 columns including "NUM" and definitions to all columns with ending /text(), still it is returning in the old fashion and I tried to change different settings and all but no use.

Thank you,

Posted: Thu Dec 05, 2013 10:52 pm
by eostic
So far, your xmloutput stage input link looks fine, so tell us about the rest of your Job. And in the meantime, test your xmloutput stage as is in a job that reads those same 3 or 4 rows from a sequential file.

What other stages are there that might be influencing things?

Ernie

Posted: Fri Dec 06, 2013 6:57 am
by eostic
One more thing to also try.....on the test that you have that uses the "num" column, I asked you to make it the "key" (repetition element). It wouldn't hurt to try a test where, with that same Job, you make title the key (turn "OFF" the key for num).

Ernie