XML file with multiple langues values

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
DS_Geelu
Participant
Posts: 2
Joined: Wed Jul 23, 2008 6:22 am

XML file with multiple langues values

Post by DS_Geelu »

Hello Everyone. This is my first post. I have scenario, need to load sequential file from xml file with multiple language values. But, need to load only English language values.

Job Design:

EXTERNAL SOURCE--->XML Input--->Transformer--->Sequential File.

And the XML file as follows:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
  <Header>
    <ID>99-012-X2011038</ID>
    <Prepared>2013-06-16T10:20:34.0955368-04:00</Prepared>
    <Sender id="STC">
      <Name xml:lang="fr">Statistique Canada</Name>
      <Name xml:lang="en">Statistics Canada</Name>
    </Sender>
  </Header>
Xpath: /Header/Sender/Name/text()

Need to load only lang="en" values into the sequential file. But, XML input stage reads the first value lang="fr default. Since, lang="en" is second value from the list, it is not been loaded.

Please let me if there are any suggestion on this.

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

Post by eostic »

Welcome aboard !

This is an interesting one. I certainly can't imagine why in your case you would only retrieve one of the languages. I did a quick test with your data and pulled up both languages downstream just fine (two rows), and then did a constraint in a downstream transformer and looked for column lang="en". Be sure that "Name" in your example is marked as a key and the repetition element.

I did notice that I wasn't able to easily do a filter on "en" directly in the xpath ( using /.../Name[@xml:lang='en']/text() directly in the Description property on the output link ), but I prefer doing filters in DataStage anyway, so I didn't debug it any further. Most future readers of your DataStage code will never know what a filter in xpath means.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
DS_Geelu
Participant
Posts: 2
Joined: Wed Jul 23, 2008 6:22 am

Post by DS_Geelu »

Thanks a lot Eostic. It worked. :D
Post Reply