XPath problems when converting flat file to XML
Posted: Wed Aug 09, 2006 2:48 pm
Hello Datastage users!
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 writing (actually I imported tabledefinitions with these paths from the XMLMDimporter) XPath expressions in 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>
Please help me out, I'm stuck.. :p
/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 writing (actually I imported tabledefinitions with these paths from the XMLMDimporter) XPath expressions in 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>
Please help me out, I'm stuck.. :p
/Dan