Login

    Register

Managed Hosting

PROJECT CATEGORIES

 

XmlToStruct
Project Home Blog Known Issues External Project Link Contact Project

XmlToStruct Issue: Array of Nodes With No Children Error

Name: Array of Nodes With No Children Error
ID: 4
Project: XmlToStruct
Type: Bug
Area: Code
Severity: Low
Status: Open
Related URL:
Creator: Steve Oz
Created: 02/10/09 1:23 PM
Updated: 02/10/09 1:23 PM
Description: If there is an array of nodes with no children (only attributes), the attributes get lost. I'm posting my work-around. Line 28
<!--- Added 2/6/2009 to allow Children with ONLY XmlAttributes to have them transferred into the array --->
            <!--- Old Line - <cfset tmpContainer = astr[n] /> - Replace by the 6 lines below --->
            <cfif isStruct(astr[n])>
               <cfset tmpContainer = astr[n] />
            <cfelse>
               <cfset tmpContainer = StructNew() />
               <cfset tmpContainer._attributes = astr["#n#_attributes"] />
            </cfif>
Line 42:
<!--- Added 2/6/2009 to allow Children with ONLY XmlAttributes to have them transferred into the array --->
               <!--- Old Line - <cfset astr[n][arrayLen(astr[n])+1] = axml.XmlChildren[i].XmlText /> - Replace by the 2 lines below. I guess this means any XML Text will be lost. Not an issue for my app --->
               <cfset astr[n][arrayLen(astr[n])+1] = StructNew() />
               <cfset astr[n][arrayLen(astr[n])]._attributes = axml.XmlChildren[i].XmlAttributes />
History: Created by steveOz (Steve Oz) : 02/10/09 1:23 PM

To add a comment to this bug, please login using the link above.