I have to loop over .htm files and search for specific fields in each file. Once field is detected I need to pull the data for that field. Here is example of the data:
Name: John, Miller
and code in htm file looks like this:
<tr>
<td><u>Name</u></td>
</tr>
<tr>
<td>John, Mille</td>
</tr>
I tried to use cffile
read:
<cffile action="read" file="\files\someFile.htm" variable="myData">
<cfoutput>#myData#</cfoutput>
Code above outputted .htm file on the screen. Is there a way to loop over the data in .htm file?
I have tried this with the Coldfusion 9:
<cfset myFile = "\files\someFile.htm">
<cfloop file="#myFile#" index="i" item="line">
<cfoutput>
#i#:#line#
</cfoutput>
</cfloop>
I got this error:
Attribute validation error for tag CFLOOP.
It has an invalid attribute combination: file,index,item. Possible combinations are:
Required attributes: 'file,index'. Optional attributes: 'charset,from,to'.
Required attributes: 'index,list'. Optional attributes: 'delimiters'.
Required attributes: 'group'. Optional attributes: 'endrow,groupcasesensitive,startrow'.
Required attributes: 'group,query'. Optional attributes: 'endrow,groupcasesensitive,startrow'.
Required attributes: 'query'. Optional attributes: 'endrow,startrow'.
Required attributes: None. Optional attributes: None.
Required attributes: 'array,index'. Optional attributes: None.
Required attributes: 'characters,file,index'. Optional attributes: 'charset'.
Required attributes: 'collection,item'. Optional attributes: None.
Required attributes: 'condition'. Optional attributes: None.
Required attributes: 'from,index,to'. Optional attributes: 'step'.
If anyone knows how to loop over the data in htm
file please let me know. Thank you.