wood burning stoves 2.0*
The moose likes Java in General and the fly likes FTP remote file parsing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "FTP remote file parsing" Watch "FTP remote file parsing" New topic
Author

FTP remote file parsing

archana gangaiah
Greenhorn

Joined: Nov 02, 2010
Posts: 15
I am trying to parse remote xml file. when i check the path of the file using outDocFile.getCanonicalFile() , it is pointing to local("C:/ct-data/ald/erd/relDeletes) but the variable(outputLocation) is pointing to "/ct-data/ald/erd/relDeletes". because of this i'm getting outDocFile.exists() =null

please let me know, if i am missing anything.


here is the code:




output:


Received Reply from FTP Connection:200
Connected Success
outputfile entity-N_CCH-61874.xml
/ct-data/ald/erd/relDeletes/
File path C:\ct-data\ald\erd\relDeletes\entity-N_CCH-61874.xml



Thanks in advance


Many Thanks,
archu
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

You're missing a lot of things. For example, you're missing an explanation of what FTP has to do with the question. (All you do with FTP is to connect to the server; you could leave that out entirely without affecting the rest of the code.)

You are also missing an explanation of why the canonical path for that pathless file name shouldn't be on your C drive. Where else do you think it should be, and why? And why are you surprised that the file doesn't exist?
archana gangaiah
Greenhorn

Joined: Nov 02, 2010
Posts: 15
Actually i want to parse remote xml file so I have used FTPClient. I am able to connect to the server and but it is not picking me the remote xml file. My problem is it is giving me IO exception( The system cannot find the file specified). I have checked the remote file permission also.


outputLocation points to remote loaction (/ct-data/ald/erd/relDeletes/ )
and oct points to the file remote file which I need to parse(entity-N_CCH-61874.xml).
outDocFile.getAbsolutePath() gives me C:\ct-data\ald\erd\relDeletes\entity-N_CCH-61874.xml


Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Well, yeah. A File object is a file on your local machine. If you want access to a file on the FTP server machine then you'll need to ask the FTPClient for that file.
archana gangaiah
Greenhorn

Joined: Nov 02, 2010
Posts: 15
Thanks for your response.It is resolved.


I have used the below FTPClient method.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: FTP remote file parsing