4 Replies Latest reply on Dec 20, 2006 5:37 PM by BrianHarcourt

    BUG? ORDINAL as XMLAttribute inside CFLOOP

    BrianHarcourt
      I have parsed an XML string into an XML document. I'm converting it into a query for future operations.
      I loop through the xmlNodes I'm interested in and all works fine except when I'm trying to retrieve an XMLAttribute on a specific XMLChild.
      ----------snip---------------
      <CFSET var recCnt = ArrayLen(NodeSet) />
      <CFLOOP index="r" from="1" to="#recCnt#">
      <CFSET bAdd = QueryAddRow(THIS.qry)>
      <CFSET tmp = QuerySetCell(THIS.qry, "AID", NodeSet[r].XmlAttributes.ID) />
      <CFSET tmp = QuerySetCell(THIS.qry, "article_title", NodeSet[r].HEADLINE.XmlText) />
      <CFSET tmp = QuerySetCell(THIS.qry, "article_abstract", NodeSet[r].ABSTRACT.XmlText) />
      <CFSET tmp = QuerySetCell(THIS.qry, "article_section_id", NodeSet[r].SECTION.XmlAttributes.ID) />
      <CFSET tmp = QuerySetCell(THIS.qry, "article_parent", NodeSet[r].XmlAttributes.PARENT) />
      <CFSET tmp = QuerySetCell(THIS.qry, "pub_name", NodeSet[r].PUBLICATION.XmlText) />
      <CFSET tmp = QuerySetCell(THIS.qry, "publish_dt", NodeSet[r].XmlAttributes.PUBLISHDATE) />
      <CFIF StructKeyExists(NodeSet[r].XmlAttributes,"TOPSTORY")>
      <CFSET tmp = QuerySetCell(THIS.qry, "TSOrdinal", NodeSet[r].XmlAttributes.TOPSTORY) />
      <CFELSE>
      <CFSET tmp = QuerySetCell(THIS.qry, "TSOrdinal", 0) />
      </CFIF>
      <CFSET tmp = QuerySetCell(THIS.qry, "StoryOrder", NodeSet[r].SECTION.XmlAttributes.ORDINAL) />
      </CFLOOP>
      ----------snip-------------
      Note that
      <CFSET tmp = QuerySetCell(THIS.qry, "article_section_id", NodeSet[r].SECTION.XmlAttributes.ID) />
      works fine, but
      <CFSET tmp = QuerySetCell(THIS.qry, "StoryOrder", NodeSet[r].SECTION.XmlAttributes.ORDINAL) />
      generates an error:
      "Element SECTION.XMLATTRIBUTES.ORDINAL is undefined in a Java object of type class coldfusion.xml.XmlNodeMap referenced as"

      When I CFDUMP the NodeSet[r].SECTION.XmlAttributes I see both the ID and the ORDINAL plain as day but when I try to reference the ORDINAL its never defined.
      I've tried DUPLICATEing the structure into a new variable and referincing.
      <CFSET AttCpy = Duplicate(NodeSet[r].SECTION.XmlAttributes) />
      <CFSET tmp = QuerySetCell(THIS.qry, "StoryOrder", AttCpy.ORDINAL) />
      Still undefined.
      I've tried looking at an array of keys from StructKeyArray. If I CFDUMP the array; ORDINAL is visible - when I try to reference the Array's position for the key, it's undefined.

      At my wits end. Any advice? Have a found a bug?