Skip to main content
nikos101
Inspiring
May 21, 2012
Question

Check is always false isXmlAttribute

  • May 21, 2012
  • 1 reply
  • 1467 views

    Hi can anyone see why Check is always false isXmlAttribute in this case?

<cfset isNullCurrencyValue = true>
  <cfset CurrencyValue          = "">
 
<cfif isXmlAttribute(structFromParsedXML.XmlAttributes["CurrencyValue"])>
  <cfset isNullCurrencyValue = false>
  <cfset CurrencyValue   = structFromParsedXML.XmlAttributes["CurrencyValue"]>
  </cfif>

This topic has been closed for replies.

1 reply

Inspiring
May 21, 2012

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

nikos101
nikos101Author
Inspiring
May 21, 2012

cool, things like this always work in my cfm page

<cfqueryparam value="#structFromParsedXML.XmlAttributes["LineDiscountValue"]#" cfsqltype="cf_sql_varchar">

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/>

nikos101
nikos101Author
Inspiring
May 21, 2012

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>