This is the XML i am trying to search:
<sds:EssayContent>one two three four five six seven eight nine ten</sds:EssayContent>
I have tried both:
<cfdump label="getthis" var="#XmlSearch(xmlDoc, "Student/Essays[EssayType='Overcoming adversity']")#" />
<cfdump label="getthis" var="#XmlSearch(xmlDoc, "sds:Student/sds:Essays[sds:EssayType='Overcoming adversity']")#" />
and nothing gets returned. What am I doing wrong?
XML Namespaces and ColdFusion are a bit tricky to work with together.
I'm affraid I don't do this enough to just spit out the solution. But I know if you Google ColdFusion and XML Namespace you will get several very good blogs that discuss the in and outs as well as how to work with it.
Your first one won't work because you don't have your namespace in there, so it'd never match anything.
However your second one works fine for me..? Well: it returns Essays which have an EssayType text value of "Overcoming adversisy", which is what I expect you want.
I'm running CF8... what are you on?
PS: thanks pointing me in the direction of the [node='its text value'] thing. I didn't know one can do that.