Try splitting the file into parts, then working on each part one at a time?
!//--
andy matthews
web developer
certified advanced coldfusion programmer
ICGLink, Inc.
[EMAIL PROTECTED]
615.370.1530 x737
--//-
-Original Message-
From: Robert Everland
Read in the file... Then convert the data into a Java string:
cfset jstrFileData = CreateObject( java, java.lang.String ).Init(
strFileData ) /
Java strings are MUCH faster and MUCH more powerful in terms of regular
expressions you might need.
You can even split the java string into an array
I have a file that I am doing a ton of parsing on.
May be CF_REextract could help you:
http://www.cftagstore.com/tags/cfreextract.cfm
--
___
REUSE CODE! Use custom tags;
See http://www.contentbox.com/claude/customtags/tagstore.cfm
(Please send any spam to
Rob,
I just put some testing together over lunch:
http://www.bennadel.com/blog/200-ColdFusion-CFHttp-To-Query-Much-Faster-Than
-Java-Buffered-Reader.htm
I was comparing CFHttp to Java input for speed. It doesn't sound like you
can use query-type data... But you might want to take a look at the
I have rewritten this procedure using the java string as opposed to listgetat,
and let me tell you this thing is lightning fast. I couldn't even get this
thing to run before, now it's faster than it ever was. Thanks for the help.
Rob,
Anytime my man. Always glad to help :)
...
Ben Nadel
www.bennadel.com
-Original Message-
From: Robert Everland III [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 08, 2006 4:30 PM
To: CF-Talk
Subject: Re: Parsing a file
I have rewritten this procedure using
]
615.370.1530 x737
--//-
-Original Message-
From: Robert Everland III [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 08, 2006 3:30 PM
To: CF-Talk
Subject: Re: Parsing a file
I have rewritten this procedure using the java string as opposed to
listgetat, and let me tell you
I reckon you'll be needing a Java CFX then.
Seemed like a fun 5 minute project so here ya go.
-
import com.allaire.cfx.*;
import java.io.*;
public class cfReadTxtFile implements CustomTag{
public void processRequest( Request request, Response response )
throws
IMHO this little square making trouble might be an ASCII null character.
A null character is a byte with 0 value. Although it is a standard character in the ASCII code,
CF will treat it as an end of string. That would explain why your text gets truncated.
So you might check if indeed there are
This might help.
cfobject type=JAVA name=jFR class=java.io.FileReader
action="">
cfset jFRobj = jFR.init('c:/somefile.txt')
cfobject type=JAVA name=jBR class=java.io.BufferedReader
action="">
cfset jBRobj = jBR.init(jFRobj)
pre
cfscript
line = ;
while ( len(line) ){
line =
e-
From: Craig Dudley
Sent: 02 October 2003 13:30
To: CF-Talk
Subject: RE: parsing txt file - seems unparsable
This might help.
cfobject type=JAVA name=jFR class=java.io.FileReader
action="">
cfset jFRobj = jFR.init('c:/somefile.txt')
cfobject type=JAVA name=j
If you're still having trouble, instead of CFFILE, try this
cfsavecontent variable=myDoc.
cfinclude template=myDoc.txt
/cfsavecontent
Now parse your file.
H.
~~
Howard Owens
Internet Operations Coordinator
Ventura County Star / E.W. Scripps
if you output the content of the file in your cf template (prior to db
insert) does it display the whole thing? If so, are you using
cfqueryparam?
I am trying to use CFFILE to parse a text file, put the
contents in a
var and then insert that into a db.
However, the file only gets parsed
I've run into this before.CF is actually opening the file correctly,
but there's a null character, and CF uses null terminated strings, so it
sees that and thinks the string is done.
At least, that's my best guess.
I've never found a way to fix this in CF, unfortunately.
--Ben
Stephenie
14 matches
Mail list logo