• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

XMLSearch difficulties

Explorer ,
Jul 21, 2010 Jul 21, 2010

Copy link to clipboard

Copied

This is the XML i am trying to search:

<sds:Student>
<sds:Essays>
       <sds:EssayType>Overcoming adversity</sds:EssayType>
       <sds:EssayContent>one two three four five six seven eight nine  ten</sds:EssayContent>
    </sds:Essays>
</sds:Student>

I have tried both:

<cfdump label="getthis" var="#XmlSearch(xmlDoc, "Student/Essays[EssayType='Overcoming adversity']")#" />

and

<cfdump label="getthis" var="#XmlSearch(xmlDoc,  "sds:Student/sds:Essays[sds:EssayType='Overcoming adversity']")#" />

and nothing gets returned.    What am I doing wrong?

TOPICS
Advanced techniques

Views

356

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jul 21, 2010 Jul 21, 2010

Copy link to clipboard

Copied

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.

HTH

Ian

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 22, 2010 Jul 22, 2010

Copy link to clipboard

Copied

LATEST

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.

--

Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation