Page 1 of 1

CSV to XML Issues

Posted: Mon Feb 20, 2006 10:35 pm
by Diya
Hi all,

We are converting CSV files(Input) to XML files(Output).

Input file format:

Empno, Ename, Job
1,X,A
2,Y,B
3,Z,C

Required Output file:

<ApplicationPrincipalAttributeValues>
<AppAttributeName>Empno</AppAttributeName>
<AppAttributeValue>1</AppAttributeValue>
</ApplicationPrincipalAttributeValues>

<ApplicationPrincipalAttributeValues>
<AppAttributeName>Ename</AppAttributeName>
<AppAttributeValue>X</AppAttributeValue>
</ApplicationPrincipalAttributeValues>

<ApplicationPrincipalAttributeValues>
<AppAttributeName>Job</AppAttributeName>
<AppAttributeValue>A</AppAttributeValue>
</ApplicationPrincipalAttributeValues>


To do this process, do we need to convert above input file to the following format shown below before converting to XML format..; or is there any other option which can convert directly to above XML output.

Empno, 1
Ename ,X
Job, A
Empno ,2
Ename, Y
Job, B
Empno ,3
Ename, Z
Job , C

Thanks,

Re: CSV to XML Issues

Posted: Mon Feb 20, 2006 10:56 pm
by anujgarg
Hi Diya,

You cannot have output like this.For that you need another root tag above your <ApplicationPrincipalAttributeValues> and use aggregate mode in setting . Then you can get this result.

Posted: Tue Feb 21, 2006 7:23 am
by chulett
Do you have a sample of this output already generated or perhaps an xsd? Use it to import the metadata of the desired target format so that the proper XPath expressions can be generated for you for use in your job.

Posted: Tue Feb 21, 2006 7:56 am
by scorpion
Thanks ,I will try this way and let you know further