Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

FTP remote file parsing

 
archana gangaiah
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Paul Clapham
Sheriff
Posts: 21305
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21305
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your response.It is resolved.


I have used the below FTPClient method.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic