Page 1 of 1

XML Output stage

Posted: Mon May 11, 2009 6:19 am
by kavish_shaz
Hi all,

I have used an XML output stage to create an xml file from a sequential file.
The sample xml file that i used to import definition is
<CustomerInfo>
<CustomerID>0000000001</CustomerID>
<Contact>
<FirstName>Lee</FirstName>
<LastName>Chen</LastName>
<Email>LeeChen@gmail.com</Email>
</Contact>
</CustomerInfo>

My source file has 3 rows. When i run the job, i'm getting the xml file as below:

<?xml version="1.0" encoding="UTF-8"?>
<!--
- Generated by Ascential Software Corporation, DataStage - XMLOutput stage -
- Mon May 04 16:56:22 2009
-->
<CustomerInfo>
<CustomerID>
1
</CustomerID>
<Contact>
<FirstName>
Lee
</FirstName>
<LastName>
Chen
</LastName>
<Email>
LeeChen@gmail.com
</Email>
</Contact>
</CustomerInfo>
<CustomerInfo>
<CustomerID>
2
</CustomerID>
<Contact>
<FirstName>
Joey
</FirstName>
<LastName>
Wang
</LastName>
<Email>
JoeyWang@sina.com
</Email>
</Contact>
</CustomerInfo>
<CustomerInfo>
<CustomerID>
3
</CustomerID>
<Contact>
<FirstName>
David
</FirstName>
<LastName>
Liu
</LastName>
<Email>
DavidLiu@gmail.com
</Email>
</Contact>
</CustomerInfo>

As can be seen from above xml, each row data is being enclosed between one <CustomerInfo> tag each. Because of additional tags, it throws me an error when opening the xml file.

Can I not have all the rows enclosed in a single <CustomerInfo> tag?
Please help me in this regard.

Thank you

Posted: Mon May 11, 2009 6:38 am
by chulett
Post the XPath Expressions you are using and let us know which column is marked as the Key column.

Posted: Mon May 11, 2009 7:09 pm
by eostic
As Craig notes, that info will be very helpful. In the meantime, you can also check to see that you are using the "aggregate" option and try making one of the lower level node elements your key (such as last name).

Ernie