As anyone had this issue with parsing from html file with setting <cfcase> values that contain spaces in the value? If the value contains spaces ColdFusion isn't able to find the data match in the parsed html file.
For example:
<CFCASE value="LGT RAIN">
<CFSET application.condition="Lt Rain">
</CFCASE>`
The html file has the value "LGT RAIN", but due to the way its being parsed it is not defining the city's condition. Is there a work around like check the condition prior to running your switch statements? Like if "LGT RAIN" is found then set cfset value it to "LGTRAIN".
Here is sample link that I am parsing from.
https://forecast.weather.gov/product.php?site=CAE&issuedby=CAE&product=RWR&format=CI&version=1
<CFSET WeatherData = CFHTTP.FileContent>
Code:
<!--- Check For Condition with Two Word Phrase --------------->
<CFSET condition= #GetToken("#content#",#attributes.citystring# + 1, " ")#>
<br>
<CFSET city = #attributes.citystring#>
<CFIF (condition is "LGT")
or (condition is "HVY")
or (condition is "FRZ")
or (condition is "MIX")
or (condition is "NOT")>
<CFSET condition= (
#GetToken("#content#",#attributes.citystring# + 1, " ")#
& " " &
#GetToken("#content#",#attributes.citystring# + 2, " ")#
)>
<br>
<CFSET Temp = #GetToken("#content#",#attributes.citystring# + 3, " ")#>'
.......
My experience with white space in text data messing up conditional logic has been with trailing spaces but the principles are the same. When in doubt look at your data. Here is a simple example: