XML output issue

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
scorpion
Participant
Posts: 144
Joined: Thu May 12, 2005 4:19 am

XML output issue

Post by scorpion »

hi all,

i am stucked with one of requirement ,can any one please helpme on this...

I want to convert .csv(input) file to .xml file(output)

input.csv file format

userid lastname firstname email
jack wilson james JWILSON@XXX.COM

job design :

seqfile------------->transformer------------.>xml out

In Transformer I have some logic

My queries are:

1)while we are working on XML OUTPUT stage,do we need to work with METADATA IMPORTER,i am not using METADATA IMPORTER,i am just writing the xpath xpressions in "Description"field.it is working fine in some scenarios

2)In other scenario..i am not getting output in required format.

Required output file format.......

<AppAttributeName>UserID</AppAttributeName>
<AppAttributeValue>JACK</AppAttributeValue>
<UserName> JACK </UserName>
</ApplicationPrincipalAttributeValues>
- <ApplicationPrincipalAttributeValues>
<AppAttributeName>LastName</AppAttributeName>
<AppAttributeValue>WILSON</AppAttributeValue>
<UserName> JACK </UserName>
</ApplicationPrincipalAttributeValues>
- <ApplicationPrincipalAttributeValues>
<AppAttributeName>FirstName</AppAttributeName>
<AppAttributeValue>JAMES</AppAttributeValue>
<UserName> JACK </UserName>
</ApplicationPrincipalAttributeValues>
- <ApplicationPrincipalAttributeValues>
<AppAttributeName>Email</AppAttributeName>
<AppAttributeValue>JWILSON@XXX.COM</AppAttributeValue>


but i am getting output with my job as below....

<ApplicationPrincipalAttributeValues>
<AppAttributeName>UserID LastName FirstName Email</AppAttributeName>
<AppAttributeValue> JACK WILSON JAMES JWILSON@XXX.COM</AppAttributeValue>
<UserName> JACK </UserName>
</ApplicationPrincipalAttributeValues>ApplicationPrincipalAttributeValues>

Could any one help on this issue

Thanks in Advance
Thanx&Regards
scorpion
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Yes, you should be taking your target file or xsd and importing its metadata into DataStage via the Import / XML Table Definitions widget. It will generate the XPath expressions you'll need - no reason for you to type them in by hand... unless you enjoy that sort of thing.
-craig

"You can never have too many knives" -- Logan Nine Fingers
scorpion
Participant
Posts: 144
Joined: Thu May 12, 2005 4:19 am

Post by scorpion »

ThanksCraig for your quick response,

We only have sequential CSV source files, we need to format the same into XML target files. We don't have any XML files ready to import via metadata importer.

But I understand that to generate XSD files we would require XML files. We do not have any XML files so that we can validate and give XPATH. We need to type XPATH manually using specified XML element tags.

Can you tell me how we can modify above generated XML output to the required output using Datastage.
Thanx&Regards
scorpion
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

scorpion wrote:We only have sequential CSV source files, we need to format the same into XML target files. We don't have any XML files ready to import via metadata importer.
At worst case create a sample XML file in the desired format, then import that. You must have some kind of target format you were given, yes? Hopefully not just on paper... whomever did that for you must be able to give you something like an xsd you could validate your output format against. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply