tracker issue : CF-4203284

select a category, or use search below
(searches all categories and all time range)
Title:

[ANeff] Bug for: ArrayLen(xmlNode) and StructCount(xmlNode) return incorrectly

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/UserError

Reporter/Name(from Bugbase): Aaron Neff / ()

Created: 08/18/2018

Components: XML

Versions: 13.0

Failure Type: Incorrectly functioning

Found In Build/Fixed In Build: 2018.0.0.310739 /

Priority/Frequency: Normal / Some users will encounter

Locale/System: / Windows 10 64 bit

Vote Count: 0

Issue: ArrayLen(xmlNode) and StructCount(xmlNode) return incorrectly

Doc says: "ArrayLen(): Determines the number of child elements in an element, that is, the number of elements in an element's XmlChildren array."

Doc says: "StructCount(): Determines the number of attributes in an element's XmlAttributes structure."

Repro (see comments for actual & expected behavior):

<cfxml variable="myXMLVar"><myXML></myXML></cfxml>
<cfscript>
  writeOutput(myXMLVar.myXML.xmlChildren.len() & ' ' & arrayLen(myXMLVar.myXML) & ' ' & myXMLVar.myXML.len())//011 (bad - should be 000)
  writeOutput(myXMLVar.myXML.xmlAttributes.count() & ' ' & structCount(myXMLVar.myXML) & ' ' & myXMLVar.myXML.count())//000 (good)
</cfscript>

<cfxml variable="myXMLVar"><myXML><child></child></myXML></cfxml>
<cfscript>
  writeOutput(myXMLVar.myXML.xmlChildren.len() & ' ' & arrayLen(myXMLVar.myXML) & ' ' & myXMLVar.myXML.len())//111 (good)
  writeOutput(myXMLVar.myXML.xmlAttributes.count() & ' ' & structCount(myXMLVar.myXML) & ' ' & myXMLVar.myXML.count())//011 (bad - should be 000)
</cfscript>

<cfxml variable="myXMLVar"><myXML attribute="value"></myXML></cfxml>
<cfscript>
  writeOutput(myXMLVar.myXML.xmlChildren.len() & ' ' & arrayLen(myXMLVar.myXML) & ' ' & myXMLVar.myXML.len())//011 (bad - should be 000)
  writeOutput(myXMLVar.myXML.xmlAttributes.count() & ' ' & structCount(myXMLVar.myXML) & ' ' & myXMLVar.myXML.count())//100 (bad - should be 111)
</cfscript>

Related URL: https://helpx.adobe.com/coldfusion/developing-applications/using-web-elements-and-external-objects/using-xml-and-wddx/modifying-a-coldfusion-xml-object.html

Attachments:

Comments:

Issue also affects xmlNode.len() & xmlNode.count(), as shown in the comments.
Comment by Aaron Neff
29535 | August 18, 2018 04:36:21 AM GMT
Hi Adobe, Can you please close this as Closed/Withdrawn/NotABug? I made a mistake, sorry! The corrected code works as expected: <cfxml variable="myXMLVar"><myXML></myXML></cfxml> <cfscript> writeOutput(myXMLVar.myXML.xmlChildren.len() & ' ' & arrayLen(myXMLVar.myXML.xmlChildren) & ' ' & myXMLVar.myXML.xmlChildren.len())//000 (good) writeOutput(myXMLVar.myXML.xmlAttributes.count() & ' ' & structCount(myXMLVar.myXML.xmlAttributes) & ' ' & myXMLVar.myXML.xmlAttributes.count())//000 (good) </cfscript> <cfxml variable="myXMLVar"><myXML><child></child></myXML></cfxml> <cfscript> writeOutput(myXMLVar.myXML.xmlChildren.len() & ' ' & arrayLen(myXMLVar.myXML.xmlChildren) & ' ' & myXMLVar.myXML.xmlChildren.len())//111 (good) writeOutput(myXMLVar.myXML.xmlAttributes.count() & ' ' & structCount(myXMLVar.myXML.xmlAttributes) & ' ' & myXMLVar.myXML.xmlAttributes.count())//000 (good) </cfscript> <cfxml variable="myXMLVar"><myXML attribute="value"></myXML></cfxml> <cfscript> writeOutput(myXMLVar.myXML.xmlChildren.len() & ' ' & arrayLen(myXMLVar.myXML.xmlChildren) & ' ' & myXMLVar.myXML.xmlChildren.len())//000 (good) writeOutput(myXMLVar.myXML.xmlAttributes.count() & ' ' & structCount(myXMLVar.myXML.xmlAttributes) & ' ' & myXMLVar.myXML.xmlAttributes.count())//111 (good) </cfscript> Thanks!, -Aaron
Comment by Aaron Neff
29536 | August 18, 2018 04:45:48 AM GMT