XML InputStage Write Issue
Moderators: chulett, rschirm, roy
XML InputStage Write Issue
Hi,
I have a xml file as source and Target is sequential file. The job flow is as follows.
External Source -- > XML Inputstage --> Sequential file
External source properties:
Source method: Specific Program
Source Program: find path -name "filename" -print
Record Type: implicit
Delimiter: None
Defined one column of maximum length.
XML Input Stage:
Stage Tab--> Transformation Setting --> Checked Repetition Element Required
Input Tab --> XML source --> XML Source column as the column defined at External Source and checked Column Content as "XML document"
Output Tab --> Columns --> defined 2 columns.
customername--varchar(30)
customertype -- varchar(10)
by providing the following "description".
customername-- /Customerlist/customer/customername/text()
customertype -- /Customerlist/customer/Customertype/text()
Job is finishing without any errors or warnings. But the data is not getting write to sequential file. Please find the sample XML feed.
<?xml version="1.0"?>
<Customerlist>
<customer>
<customername>ABC Limited</customername>
<Customertype>WB</Cutomertype>
</customer>
<customer>
<customername>Nelson</customername>
<customertype>CB</customertype>
</Customer>
</Customerlist>
Please help on it....
I have a xml file as source and Target is sequential file. The job flow is as follows.
External Source -- > XML Inputstage --> Sequential file
External source properties:
Source method: Specific Program
Source Program: find path -name "filename" -print
Record Type: implicit
Delimiter: None
Defined one column of maximum length.
XML Input Stage:
Stage Tab--> Transformation Setting --> Checked Repetition Element Required
Input Tab --> XML source --> XML Source column as the column defined at External Source and checked Column Content as "XML document"
Output Tab --> Columns --> defined 2 columns.
customername--varchar(30)
customertype -- varchar(10)
by providing the following "description".
customername-- /Customerlist/customer/customername/text()
customertype -- /Customerlist/customer/Customertype/text()
Job is finishing without any errors or warnings. But the data is not getting write to sequential file. Please find the sample XML feed.
<?xml version="1.0"?>
<Customerlist>
<customer>
<customername>ABC Limited</customername>
<Customertype>WB</Cutomertype>
</customer>
<customer>
<customername>Nelson</customername>
<customertype>CB</customertype>
</Customer>
</Customerlist>
Please help on it....
Cheers
Ravi K
Ravi K
I've never tried using that technique in the External Source stage... I would suggest you use list (ls) and send the list of filenames, and then change the check box to "url" inside of the xmlInput Stage (see the table of contents at www.dsrealtime.com for an entry on xml and how to define sources).
Otherwise, it looks like you should be ok...everything else seems ok, assuming you have one of those two columns checked as a "key" (repetition element).
Ernie
Otherwise, it looks like you should be ok...everything else seems ok, assuming you have one of those two columns checked as a "key" (repetition element).
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>
As you suggested, i have used "ls" command to list the file at External source and after tried view data then i got the URL as good as follows.
/home/bslops1/ravi/ABC.xml
Changed column content to "URL/File Path" and already defined 1 column as Key.
Providing the following "description" at XML InputStage--> Output-->Columns --> "Description"
customername--> /Customerlist/customer/customername/text()
customertype --> /Customerlist/customer/Customertype/text()
Job completed without any errors and warning.. But no records at Target.
/home/bslops1/ravi/ABC.xml
Changed column content to "URL/File Path" and already defined 1 column as Key.
Providing the following "description" at XML InputStage--> Output-->Columns --> "Description"
customername--> /Customerlist/customer/customername/text()
customertype --> /Customerlist/customer/Customertype/text()
Job completed without any errors and warning.. But no records at Target.
Cheers
Ravi K
Ravi K
-
- Premium Member
- Posts: 72
- Joined: Mon Jul 06, 2009 9:34 pm
- Location: Sydney
you have to read the element 'customer' in the output and define it as the key along with the text fields from the element. It has worked for me. The input as you mentioned should be a 'FilePath' and read as single column.
Remember to give Xpath expressions correctly.
Remember to give Xpath expressions correctly.
Prakash Dasika
ETL Consultant
Sydney
Australia
ETL Consultant
Sydney
Australia
As you suggested i read the element by defining it as key at output. The input as File Path and Single column.prakashdasika wrote:you have to read the element 'customer' in the output and define it as the key along with the text fields from the element. It has worked for me. The input as you mentioned should be a 'FilePath' and read as single column.
Remember to give Xpath expressions correctly.
Imported XML meta data. Defined the XPATH. For your referrence find the XPATH.
/customerlist/customer
/customerlist/customer/customername/text()
/customerlist/customer/customertype/text()
But still no errors or warnings. There is no data at Target.
Cheers
Ravi K
Ravi K
-
- Participant
- Posts: 41
- Joined: Sat Jun 06, 2009 11:13 pm
- Location: Kolkata
I enabled "Log Reject Errors". Now it catch up with an Warning. Please find the Warning details.
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=/home/bslops1/ravi/ABC.xml
But when i checked at the server the file is available.
/home/bslops1/ravi>ls -lrt ABC.xml
-rw-r--r-- 1 bslops1 dstage 238 Jan 19 13:47 ABC.xml
/home/bslops1/ravi>
Please help for the issue.
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=/home/bslops1/ravi/ABC.xml
But when i checked at the server the file is available.
/home/bslops1/ravi>ls -lrt ABC.xml
-rw-r--r-- 1 bslops1 dstage 238 Jan 19 13:47 ABC.xml
/home/bslops1/ravi>
Please help for the issue.
Cheers
Ravi K
Ravi K
Make sure you can open the document yourself using IE. Something is failing in its structure, or odd characters, or else maybe the way you are reading it via the External Source stage is an issue. I always use ls ...
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>
Earine your anticipation is correct. I changed column length to 100 at external source and there are some problems at XML source also find out when i was opened in IE (Problem is at Tags <customer> and </Customer>. The letters are case sensitive and changed that letters and issue is resolved)eostic wrote:Make sure you can open the document yourself using IE. Something is failing in its structure, or odd characters, or else maybe the way you are reading it via the External Source stage is an issue. I always use ls ...
Tried using the following mechanism and works fine with External source.
Source method: Specific Program
Source Program: echo /home/bslops1/ravi/ABC.xml
Or
Source Program:ls /home/bslops1/ravi/ABC.xml
Thanks a lot for all your inputs.
Cheers
Ravi K
Ravi K
Excellent. Glad you got it working.
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>