开发者

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:

XMLSearch and display node info


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜