I am having trouble w/ my server being able to read and parse a 92mb xml file.
Currently I am using:
<cffile action="read" file="file.xml" variable="theXml">
<cfset myXml = xmlParse(theXml)>
Is there any suggestions on how to read and parse a 92mb xml file?
Grizzly9279 - 13 Sep 2007 22:11 GMT
Wow, I've never tried to parse an XML file quite that large before. Does it
contain a bunch of encoded binary data, or does it have houndreds of thousands
of xml-nodes?
In any event, I do have one thought:
Do you need absolutely everything in the file? If you only need access to a
small portion of it, it would be worth your while to pull out only the "stuff"
that you need before you parse it. You could use regular expressions to strip
out things you don't need, or to pull out only the stuff you do need.
The more you can minimize the "parse" effort the better off you'll be.
Alternatively, if it's a file describing many "records" of the same type, it
would be best if you could "chunk" the file and parse each record individually.
Ian Skinner - 13 Sep 2007 22:43 GMT
There are relatively simple ways to dive into the Java underpinnings of
modern CF servers and read large files such as this line by line,
instead of trying read and digest the entire thing in one bite.
But the XML aspect of this data may complicate things since the nature
of xml data may make it challenging to parse the file bit by bit. I
suspect the built in CF XML functions are going to want a complete data
set with all appropriate opening and closing tags to work. You may need
to roll your own or something, I'm not sure.
BKBK - 14 Sep 2007 06:23 GMT
[i]> ...to read and parse a 92mb xml file[/i]
The cffile is superfluous here. Just parse the path directly, like this
<cfset myXml = xmlParse("C:\ColdFusion8\wwwroot\website\file.xml")>
BKBK - 14 Sep 2007 06:25 GMT
Oh, and, please tell us whether you could load the biggie.