Couldn't able to read xml file

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
rsunny
Participant
Posts: 223
Joined: Sat Jul 03, 2010 10:22 pm

Couldn't able to read xml file

Post by rsunny »

Hi ,

I am trying to read xml file and load it into text file .
I used External Source->xml input->transformer->sequential file
In External Source , i Have specified
Source Method as Specific Program
Source program as ls /abc/ghe/books.xml
Record Type as implicit
Record delimiter as none
In Xml input stage , i have specified url/filepath in input tab
When i ran the job i got the below error

XML input document parsing failed. Reason: Xalan fatal error (publicId: , systemId: , line: 0, column: 0): An exception occurred! Type:RuntimeException, Message:The primary document entity could not be opened. Id=/abc/ghe/books.xml

The sample xml is as follows
<x:books xmlns:x="urn:books">
<book id="bk001">
<author>Writer</author>
<title>The First Book</title>
<genre>Fiction</genre>
<price>44.95</price>
<pub_date>2000-10-01</pub_date>
<review>An amazing story of nothing.</review>
</book>

<book id="bk002">
<author>Poet</author>
<title>The Poet's First Poem</title>
<genre>Poem</genre>
<price>24.95</price>
<review>Least poetic poems.</review>
</book>
</x:books>


Could anyone please help me out in resolving this issue
svga
Participant
Posts: 73
Joined: Thu Aug 07, 2008 6:31 am
Location: Syracuse

Post by svga »

Can you share the Xpath you have defined in the XML input stage?

/Sankar
rsunny
Participant
Posts: 223
Joined: Sat Jul 03, 2010 10:22 pm

Post by rsunny »

Hi ,

I have included the namespace declaration in xml input stage

xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:defns="urn:books"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"

I am not sure about the xpath.

Can you let me know where do we need to define the xpath.
I have defined the path for each column in the output tab of the xml input stage
rsunny
Participant
Posts: 223
Joined: Sat Jul 03, 2010 10:22 pm

Post by rsunny »

Any help for the above issue is really appreciated
rsunny
Participant
Posts: 223
Joined: Sat Jul 03, 2010 10:22 pm

Post by rsunny »

Is there any other alternative solution to read the xml files besides using with External Source or Sequential file stage?
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Have you done any searches? There are hundreds of threads with a similar subject....you need to use the xml metadata importer and define your columns ---- when you do, your xpath will be in the description property of your table def.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
rsunny
Participant
Posts: 223
Joined: Sat Jul 03, 2010 10:22 pm

Post by rsunny »

Hi Ernie,

I have used xml metadata importer and defined in the columns and the xpath is also defined in the description for each column but still couldn't able to read the xml file.

I have done searches but couldn't able to find the solution.

Any help is really appreciated
rsunny
Participant
Posts: 223
Joined: Sat Jul 03, 2010 10:22 pm

Post by rsunny »

Any idea of what would be the issue?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Your file "could not be opened". First two things that come to mind are that it either doesn't exist (which seems unlikely given the 'ls' worked) or you have a permissions issue.
-craig

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