This content has been marked as final. Show 3 replies
xmlSearch() returns an XML node, which is a complex data type (think structure). Once you retrieve your XML node, you then have to parse out the data you want (do a <cfdump> on your xmlsearch() results to see what I mean).
The solution is pretty simple:
<cfset xmlNode= xmlsearch(xmlcustomer, "name[@part='first']")>
<cfset customer.firstname = xmlNode.xmlText>
Here is a simple example, I want to search a employee with id of 23
<cfset mydump = xmlSearch(myXml,'/employee [@id='23']/*') >
<cfdump var="#mydump #">
see the dump value, it will show you the returned structure.
hopefully this will help you in understanding of xmlsearch.
Thanks for the replies. I was able to work through it in the mean time and here is the way that I resolved it:
<cfset fName = xmlsearch(xmlcustomer, "name[@part='first']")>
<cfset xmlFName = xmlparse(fName, "yes")>
<cfset customer.firstname = xmlFName["name"]["XmlText"]>
<cfset lName = xmlsearch(xmlcustomer, "name[@part='last']")>
<cfset xmlLName = xmlparse(lName, "yes")>
<cfset customer.lastname = xmlLName["name"]["XmlText"]>