One Star mii
One Star

Parse http xml reponse without creating temp file

Hello,
I'm starting with TOS.
I want to get the response of a http request (is a xml output) and then parse it.
I don't want to use a temporary file to store the xml file, I rather like to parse it directly.
My first approach is:
tFileFectch --> tCreateTemporaryFile --> tFileInputXML
Is there any way to achieve this functionality without creating a temporary file?
Any suggestions?
Thanks in advance.
Regards,
Mikel.
7 REPLIES
Community Manager

Re: Parse http xml reponse without creating temp file

Hello
Yes, you can parse the xml file directly after you get it from URL. The job looks like:
tFileFectch -->OnSubJOBOK--> tFileInputXML-->
Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star mii
One Star

Re: Parse http xml reponse without creating temp file

Hello,
If I use the following structure:
tFileFectch -->OnSubJOBOK--> tFileInputXML
Assume in tFileFetch I get a XML from a URL: hhtp://www.example.com/helloworld.xml
How can I specify in tFileInputXML Filename field the previous entry?
Thanks in advance.
Regards,
Mikel.
Community Manager

Re: Parse http xml reponse without creating temp file

Hello Mikel
You are using tFileFetch to featch the xml, you will specify the folder path and file name on tFileFetch. eg:
Destination directory: "c:/shong"
Destiination file name: "helloworld.xml"
On tFileInputxml, specify the file path from local machine. eg:
"c:/shong/helloworld.xml"

Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star mii
One Star

Re: Parse http xml reponse without creating temp file

Hello,
Ok, I understand.
But I don't want to store a file into filesystem.
My objetive is to read the http response (xml) and parse it without saving the file.
It is this possible? or at least I need to store a temp file?
Regards,
Mikel.
Community Manager

Re: Parse http xml reponse without creating temp file

Hello
It is this possible? or at least I need to store a temp file?

Delete the file at the end of job. eg:
get file from url and parse xml file
|
onSubjobOk
|
tFileDelete
Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star aca
One Star

Re: Parse http xml reponse without creating temp file

Is it posible to do this:
t_fetch_http_request_as_xml => t_parse_xml => tFileOutputDelimeited
Can you tell me what to use for t_fetch_http_request_as_xml and t_parse_xml with some details to get below results.
I don't want any temp files on file system if possible.
Input XML over http
<xml>
<row type="type1" name="1">
<row type="type1" name="2">
<row type="type1" name="3">
<row type="type2" name="4">
<row type="type2" name="5">
<row type="type2" name="6">
</xml>
result csv file
type1,1
type1,2
type1,3
type2,4
type2,5
type2,6
One Star

Re: Parse http xml reponse without creating temp file

Hi Aca,
Yes, this is possible.
See my attached screen shot 1.
Make sure you check the "Use cache to save the resource" check box in the properties of the tFileFetch component (screen 2) and use this cache stream as input on the tFileInputXML (screen 3)
Good luck!
Regards,
Arno