Hello community, first of all, for all of you in US, happy 4th of July!
I am having an issue I need some help with: I need to connect to an sFTP server, retrieve the list of XML files (files will be placed there for CF to do something with them) and then loop through the contents of these XML files and insert the values into a database.
This is what I do: I open the connection and ask for the list of files using CFFTP. That works perfectly. Now, when I use xmlParse() to retrieve the XML content, when the file is in this sFTP server, I get the error "Content Is Not Allowed In Prolog". If the same file I place it on my own website for testing, then contents are shown without any issue.
From the image, is line 30 where I tell CF where the file is located.
I have tried BenNadel's post about this issue (Content Is Not Allowed In Prolog - ColdFusion XML And The Byte-Order-Mark (BOM) ) but didn't work. Using this suggestion the error says "Premature End of File".
The XML file I am testing with is the same in both locations.
Any help will be highly appreciated.
Copy link to clipboard
I'm pretty sure that CFFTP doesn't let you remotely read files. It lets you fetch the files to your own server, where you can do what you like with them. So you'll need to fetch all of the files to your local server, then loop over the directory where you put them to read the files with xmlParse. If the files have a valid HTTP path on the remote server, then you could dispense with CFFTP entirely and fetch them via HTTP instead.
Dave Watts, Eidolon LLC
Thank you Dave for you reply. Not able to connect now for some reason but will try your recommendation.
I appreciate your time to answer.