XPath problem when transforming flat file to XML
Posted: Wed Aug 09, 2006 12:59 pm
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
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