Working with XML

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
Harini
Premium Member
Premium Member
Posts: 80
Joined: Tue Mar 16, 2010 1:32 am

Working with XML

Post by Harini »

Hello All,

I am trying to read from a xml file and load the data into SQL Server.

My job design is as follows.

External Source Stage -> XML Input Stage -> Transformer -> ODBC

Here, the problem is the data in table is entered along with the XML Tags :(

Eg: <Name>Meena</Name>
<DOB> 21121986 </DOB>

In the target table columns are Name, and DOB. The data entered looks like
Name, DOB
<Name>Meena</Name>, <DOB> 21121986 </DOB>

Please help on how to remove the tags in the target data

Thanks
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Look at the output link of your XML Input Stage.....go to the Descriptions of each column..... chances are, the elements you are retrieving are missing the final /text() from the xpath syntax. Without the "text()" it means "get the whole element".......

....so it should be .../.../.../DOB/text() ...and so forth.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
samyamkrishna
Premium Member
Premium Member
Posts: 258
Joined: Tue Jul 04, 2006 10:35 pm
Location: Toronto

Re: Working with XML

Post by samyamkrishna »

while giving the XPATH derivations

give /Name/text() and /DOB/text().

this will get only teh data and no tags.
Harini
Premium Member
Premium Member
Posts: 80
Joined: Tue Mar 16, 2010 1:32 am

Post by Harini »

eostic wrote:Look at the output link of your XML Input Stage.....go to the Descriptions of each column..... chances are, the elements you are retrieving are missing the final /text() from the xpath syntax. Without the "text()" it means "get the whole element".......

....so it should be .../.../.../DOB/text() ...and so forth.

Ernie
Thanks a lot friends ! It worked ! :)
Post Reply