Thank you, thank you! Seems so easy, but I just couldn't get it -- makes total sense now. Much appreciated,
No worries, it's a Friday afternoon and I had lots of more boring work to get out of.
Well, I may have spoken too soon....or actually a slightly different question. Now I want to access an element. I'm looping over the result after counting the number of responses, but when I try and access the element using the loop index, it can't find it -- is this because I bracketed it?
<cfloop from="1" to="#numtitles#" index="a">
Break it down slowly, use single quotes if needed inside doubles and and reference the XmlChildren attribute to get child elements. Something like this:
<cfloop from="1" to="#arraylen(xmlfile['ns3:LookupMyAccountInfoResponse'].xmlChildren)#" index="i">
<cfset thisElement = xmlfile['ns3:LookupMyAccountInfoResponse'].xmlChildren[i] />
<cfloop from="1" to="#arrayLen(thisElement.xmlChildren#" index="j">
<cfset thisInnerElement = thisElement.xmlChildren[j] />
<cfdump var="#thisInnerElement#" />
Until you have everything you're after. The important thing to remember is that child elements are represented by an ARRAY by the name XmlChildren.
Thanks again. I'm still learning how to work with XML, so your response is most helpful.
No worries, it's a bit odd as with CF you never *really* deal with XML when reading - you tend to deal with XML that's been converted into CF structs and arrays. You basically need to completely forget that you're dealing with XML, and just deal with it as you would any CF structure.
Don't try and do too much in one go, frequently dump out your variables to check you have what you *think* you have, and you'll get the hang in no time