Reading XML Files using seq file stage
Moderators: chulett, rschirm, roy
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
Ernie Ostic
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Carefully check your readio button on the stage vars.... I often forget to change it from URL to XMLContent or back again....
Ernie
Ernie
Ernie Ostic
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
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
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
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
...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>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
oops. I meant ColumnImport above.
Ernie Ostic
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
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
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
You can not.kumar66 wrote:Actually i have done this job in server . Now the requirement is to do in parallel .
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.
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
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