One thing that may not be obvious is that you can do the following to get to the parent of a node:
<cfset parent = XmlSearch(blah[1], "../")> -Nelson On Mon, Apr 21, 2008 at 9:00 AM, Steven Ross <[EMAIL PROTECTED]> wrote: > I'm about to blog about this but, wanted to get everyone's perspective > first. > > Check out this bit of code (read inline comments). I believe it is sort of a > bug (or at least a 'gotcha') in the way CF sees xml search results. > > > > > > <cfxml variable="test"> > > <test> > > <node> > > <nodes> > > <nodeline>blah1</nodeline> > > </nodes> > > <nodes> > > <nodeline>blah2</nodeline> > > </nodes> > > <nodes> > > <nodeline>blah3</nodeline> > > </nodes> > > </node> > > </test> > > </cfxml> > > > > > <cfset blah = XMLSearch(test, "//nodes")/> > > > > > <cfset blah1 = blah[1]/> > > > > > <cfdump var="#blah1#"> <!--- root node in dump appears to be "nodes" but > dump of blah1.nodes fails. it only works if you dump blah1.nodeline ---> > > > > > <cfdump var="#blah1.nodes#"> <!--- this line fails ---> > > > > > > <cfdump var="#blah1.nodeline#"> <!--- this does not ---> > > > > > > > > And of course if you ToString the results and then xml parse again then you > get the expected CF behavior ie: > > > > > <cfset xmlStr = ToString(blah[1]) /> > > > > > <cfset theXML = XMLParse(xmlStr) /> > > > > > <cfdump var="#theXML.nodes#"> > > > > > > > > > -Steven > > > > > -- > Steven Ross > web application & interface developer > http://blog.stevensross.com > [mobile] 404-488-4364 [fax] (404) 592-6885 > [ AIM / Yahoo! : zeriumsteven ] [googleTalk : nowhiding ] > ------------------------------------------------------------- > Annual Sponsor - Figleaf Software > > To unsubscribe from this list, manage your profile @ > http://www.acfug.org?fa=login.edituserform > > For more info, see http://www.acfug.org/mailinglists > Archive @ http://www.mail-archive.com/discussion%40acfug.org/ > List hosted by FusionLink > ------------------------------------------------------------- ------------------------------------------------------------- Annual Sponsor FigLeaf Software - http://www.figleaf.com To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com -------------------------------------------------------------
