>- see footer for list info -< Well the xpath search is saying find me all myelement nodes and get the xmltext so even if there is just one the result will be in an array so you have to loop.
If you wanted to not loop then don't use xpath just reference mYXML.myroot.myelement.xmltext Alex -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dominic Watson Sent: 03 July 2007 19:35 To: Coldfusion Development Subject: [CF-Dev] XMLSearch >- see footer for list info -< I'm reading up on XML and playing around with some XPath stuff in CF. I am trying to use the text() location step to get at just the xmlText of the element I am searching for, e.g. aResults = XMLSearch(myXML,'myroot/myelement/text()'); This produces an array of objects of 'unknown type'. I do like this... <cfdump var="#aResults[1].GetClass().GetName()#"> ...and see that the object's class is "*org.apache.crimson.tree.TextNode*". I then look this up on t'internet and eventually find an inherited method called GetData() which returns the string. So: aResults = XMLSearch(myXML,'myroot/myelement/text()'); for(i=1; i LTE aResults.size(); i=i+1) WriteOutput(aResults[i].GetData()); Surely this is lunacy?! Is there another way to get at the XMLText with XPath without having to loop? Thanks in advance, Dom _______________________________________________ For details on ALL mailing lists and for joining or leaving lists, go to http://list.cfdeveloper.co.uk/mailman/listinfo -- CFDeveloper Sponsors:- >- cfdeveloper Hosting provided by www.cfmxhosting.co.uk -< >- Lists hosted by www.Gradwell.com -< >- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -< -- This message has been scanned for viruses and dangerous content by Trusted Management Limited, and is believed to be clean. -- This message has been scanned for viruses and dangerous content by Trusted Management Limited, and is believed to be clean. _______________________________________________ For details on ALL mailing lists and for joining or leaving lists, go to http://list.cfdeveloper.co.uk/mailman/listinfo -- CFDeveloper Sponsors:- >- cfdeveloper Hosting provided by www.cfmxhosting.co.uk -< >- Lists hosted by www.Gradwell.com -< >- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<
