user281867
user281867

Reputation: 587

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=XMLParse(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:

Screenshot of XML dump

Upvotes: 1

Views: 154

Answers (2)

user281867
user281867

Reputation: 587

I was able to extract the data by doing this Qdata[1].name.firstname.xmltext.

Upvotes: 1

Paul Carney
Paul Carney

Reputation: 146

Looks like you are missing the "name" element. Try "Qdata.beatle.name.firstname.xmltext" to see if that works.

Upvotes: 0

Related Questions