On 7/8/05, Rebecca Wells <[EMAIL PROTECTED]> wrote: > How do you parse out this kind of XML string? I need to find the value > of aAccountNumber and bAddress: > > <Parameter> > <ParameterName>aAccountNumber</ParameterName> > <ParameterValue>XXXXX</ParameterValue> > </Parameter> > <Parameter> > <ParameterName>bAddress</ParameterName> > <ParameterValue>XXXXX</ParameterValue> > </Parameter>
xPath to the rescue: <cfxml variable="myDOM"> <doc> <Parameter> <ParameterName>aAccountNumber</ParameterName> <ParameterValue>12345</ParameterValue> </Parameter> <Parameter> <ParameterName>bAddress</ParameterName> <ParameterValue>USA</ParameterValue> </Parameter> </doc> </cfxml> <cfset accountNumber = xmlSearch(myDOM,"doc/Parameter[./ParameterName='aAccountNumber']/ParameterValue")> <cfset address = xmlSearch(myDOM,"doc/Parameter[./ParameterName='bAddress']/ParameterValue")> <cfoutput> Account Number: #accountNumber[1].xmlText#<br> Address: #address[1].xmlText#<br> </cfoutput> If you have multiple account number nodes, you would need to loop over the array accountNumber[]. Same applies to the array address[]. HTH -- Eddie Awad. http://awads.net/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:211446 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54