Reading XML Files using seq file stage

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

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

Post by eostic »

Did you change the radio button so that it says "URL" and not "XML Content" for your incoming column name ? That happens to me a lot...it's easy to forget.....

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
kumar66
Participant
Posts: 265
Joined: Thu Jul 26, 2007 12:14 am

Post by kumar66 »

Hi Ernie,

Yes I have checked that radio buttom to URL file path.

Thanks,

With Regards,
Kumar66
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Carefully check your readio button on the stage vars.... I often forget to change it from URL to XMLContent or back again....

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
kumar66
Participant
Posts: 265
Joined: Thu Jul 26, 2007 12:14 am

Post by kumar66 »

Hi Ernie,



The suggestion you specified have worked for the foolwoing XML file. Thanks for that.

?xml version="1.0" encoding="UTF-8" ?>
- <!-- - Generated by Ascential Software Corporation, DataStage - XMLOutput stage -
- Wed Jan 20 16:14:30 2008

-->
- <xtd:BO xmlns:xtd="http://GenericSchema" xmlns:esb="http://schemas/SHeader" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <esb:SHeader>
<esb:EnvironmentName>PRODUCTION</esb:EnvironmentName>
</esb:SHeader>
- <xtd:load>
- <xtd:Record>
<STR_CD>F1</STR_CD>
<STR_YR>2006</STR_YR>
<BEG_NBR>1</BEG_NBR>
<BEG_YR>2006</BEG_YR>
<END_NBR>13</END_NBR>
<END_YR>2006</END_YR>
<MEM_ID>FS2006_F1</MEM_ID>
<BRD_ID>2</BRD_ID>
</xtd:Record>
/xtd:load>
</xtd:BO>




But I am not able to read the xml with this pattern. Is anthing to be done with the "CDATA"


<?xml version="1.0" encoding="UTF-8" ?>
- <!-- - Generated by Ascential Software Corporation, DataStage - XMLOutput stage -
- Wed Jan 16 14:21:40 2008

-->
- <xtd:BO xmlns:xtd="http://GenericSchema" xmlns:esb="http://schemas/SHeader" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <esb:SHeader>
<esb:EnvironmentName>Development</esb:EnvironmentName>
</esb:SHeader>
- <xtd:load>
- <xtd:Data>
- <![CDATA[ 800009885|700930010|S 9885 PLACE ST FOY|STORES|MALL ENCLOSED|000000980|000000000|000007910|000007910|000008890|BDC-0015|ST FOY||CA|CANADA|Can Dollar|000000000|ACTIVE|01/03/09| | | |COMP|02/03/08|000009885|
</xtd:Data>
</xtd:load>
</xtd:BO>


Please Advise.

Thanks,

With Regards,
Kumar66
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Hi Kumar66

...a couple of things to note here...not sure exactly which might be the issue you are having...

First, the CDATA should have no impact on the method by which you read in the file, whether it be via Folder or URL, etc. Second, this "particular" snippet of XML is in error, because the CDATA element is not closed, so I will assume it was just because of cut/paste, or maybe I can't see it in my browser for some reason ( CDATA has to be <![CDATA[yada yada]]> ). Third, you should grab the "whole" element and parse further to make any sense of CDATA on your own... so have a column in your job that has xpath of:

/BO/load/Data/

That will get you the whole Data element and you can parse it out from there if needed....(RowSplitter in Server, ColumnExport, etc.).

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

oops. I meant ColumnImport above.
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
kumar66
Participant
Posts: 265
Joined: Thu Jul 26, 2007 12:14 am

Post by kumar66 »

Hi Ernie,

Thanks for your repley.

so I have my xpath as : " /xtd:BO/xtd:BOload/xtd:Data/text()" and even I have checked my xml file , it has a proper closure of CDATA.

Still I am not able to read the xml files. I get these warnigs :

" Missing record delimiter "\x00", saw EOF instead"
" Import warning at record 0".

Please Advise,

Thanks & Regards,
Kumar66
Teej
Participant
Posts: 677
Joined: Fri Aug 08, 2003 9:26 am
Location: USA

Post by Teej »

kumar66 wrote:Actually i have done this job in server . Now the requirement is to do in parallel .
You can not.

The problem lies in the way Sequential File stage works for Parallel jobs. It requires at least one record delimiter before an EOF character is found.

So what you need to do instead is to use a Server Shared Container to read in the file using the Server's Sequential File stage.

OR

You can just use the XML stage itself to read in the file.
kumar66
Participant
Posts: 265
Joined: Thu Jul 26, 2007 12:14 am

Post by kumar66 »

Hi Teej,

But I am using external source stage. Whether I need to specify any delimiter in the format tab.

Please Advise.

Thanks & Regards,
Kumar66
kumar66
Participant
Posts: 265
Joined: Thu Jul 26, 2007 12:14 am

Post by kumar66 »

Hi Ernie,


Thanks so much for your suggestions . I have resolved the problem. It was fault in setting the format tab.


I just set the final delimiter =none and the xml input stage is able to pick the file and I sucessfully loaded into the target.

I Thank once again to Ernie ,Chulett and Teej.


With Regards,
Kumar66
akarsh
Participant
Posts: 51
Joined: Fri May 09, 2008 4:03 am
Location: Pune

Post by akarsh »

Hi Kumar,

Can you please explain how did you achieve this?
I am also facing the same issue.
Thanks,
Akarsh Kapoor
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Five and a half years later and several things discussed... you have WHAT issue, exactly?
-craig

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