XMLSearch and display node info
I'm trying to display the XML node data returned from XMLSearch and am having a problem displaying the data. I tried outputting the data like this:
<cfset xmlBeatles=XMLPar开发者_如何学JAVAse(ExpandPath("Beatles.xml"))>
<cfset Qdata = XMLsearch(xmlBeatles,"//beatle[1]")>
#Qdata.beatle.firstname.xmltext# or #Qdata[1].beatle.firstname.xmltext#
but am getting this error:
You have attempted to dereference a scalar variable of type class coldfusion.runtime.Array as a structure with members.
Sample XML:
I was able to extract the data by doing this Qdata[1].name.firstname.xmltext
.
Looks like you are missing the "name" element. Try "Qdata.beatle.name.firstname.xmltext" to see if that works.
精彩评论