Copy link to clipboard
Copied
Hi can anyone see why Check is always false isXmlAttribute in this case?
<cfset isNullCurrencyValue = true>
<cfset CurrencyValue = "">
<cfif isXmlAttribute(structFromParsedXML
<cfset isNullCurrencyValue = false>
<cfset CurrencyValue = structFromParsedXML
</cfif>
Copy link to clipboard
Copied
Without seeing your XML... no, no-one will be able to see why.
However the variable name sets off an alarm: "strucTFromParsedXML". Sounds like a struct to me, not an XML object.
--
Adam
Copy link to clipboard
Copied
cool, things like this always work in my cfm page
<cfqueryparam value="#structFromParsedXML
but this is always being set as null:
<cfqueryparam value="#CurrencyValue#" cfsqltype="cf_sql_varchar" null="#isNullCurrencyValue#">
but the xml with CurrencyValue sometimes does not have the attribute compare these:
<NewOrders SupplyMargin="1" SalesMargin="2" LineDiscountName="" LineDiscountValue="0"/>
with
<NewOrders SupplyMargin="1" SalesMargin="2" LineDiscountName="" LineDiscountValue="0" CurrencyValue = 200/>
Copy link to clipboard
Copied
oh and the struct is beign set like this:
<cfset structFromParsedXML = GetDataFromFeed(parsedXML)>
<cfscript> | |||
function GetDataFromFeed(xmlFeed) | |||
{ | |||
var final = arrayNew(1); | |||
var i = 1; | |||
var j = 1; | |||
var children = arrayNew(1); | |||
allOrders = XmlSearch(xmlFeed, "ROOT/NewOrders"); | |||
return allOrders; | |||
} | |||
</cfscript> |
Copy link to clipboard
Copied
nikos101 wrote:
<cfset structFromParsedXML = GetDataFromFeed(parsedXML)>
Then it is actually an array. Hence:
<cfset arrayFromParsedXML = GetDataFromFeed(parsedXML)>
"ROOT/NewOrders"
Remember that the search is case-sensitive. Therefore, use the exact case of the elements root and newOrders.
Copy link to clipboard
Copied
Look... we need to see:
a) sample XML
b) the code that creates structFromParsedXML
Not an extract of the XML. Not a description of how you get it. The actual XML.
And, similarly, the actual code that creates the variable.
I expect to be able to copy and paste the XML and code you provide, and run it myself here.
--
Adam
Copy link to clipboard
Copied
Adam Cameron. wrote:
Look... we need to see:
b) the code that creates structFromParsedXML
See above.
Copy link to clipboard
Copied
Yeah, OK, thanks for that. I don't mean a function that takes some unknown input and has a bunch of unnecessary code and then does an xmlSearch() and returns that. I mean the end-to-end code starting with the XML and finishing with the problem. A repro case, basically.
--
Adam