XPath problem when transforming flat file to XML

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
Daniel Zackrisson
Participant
Posts: 4
Joined: Wed Jul 26, 2006 10:19 am

XPath problem when transforming flat file to XML

Post by Daniel Zackrisson »

Hello!

I work on a data migration project and try to convert data from a tabular file to an XML-format. When I run my job i extract a row from the table like the second line below:

TYPE,level_type1,LINE,level_type2
C,1,AC,2

And want to create an XML output like this:

<Product_class>
<name>C</name>
<level_type>1</level_type>
</Product_class>
<Product_class>
<name>AC</name>
<level_type>2</level_type>
</Product_class>

I did this by generating XPath expressions in the XMLmetadataimporter.exe and load the table definitions into the XML output stage, the column tab like this:

Column name,.......................,Description
TYPE,....................................,/Product_class/name/text()
level_type1,..........................,/Product_class/level_type/text()
LINE,.....................................,/Product_class/name/text()
level_type2,..........................,/Product_class/level_type/text()

The output I get is:

<Product_class>
_<name>C AC </name>
_<level_type>1 2</level_type>
</Product_class>

Does anyone knows the correct way to write the X-Paths?

/Dan
Aquilis
Participant
Posts: 204
Joined: Thu Apr 05, 2007 4:54 am
Location: Bangalore
Contact:

Re: XPath problem when transforming flat file to XML

Post by Aquilis »

Hello All,
Does anybody got any workaround for this kind of XML file generation.
If so, let me know. i am also facing same kind of problem.

Thanks in advance.
Aquilis
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

'Same kind of problem' doesn't cut the mustard. Start a new post. Link back to this post if you think it will help, but tell us exactly what your problem is, not that it's similar to this one. :?
-craig

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