Skip to content

Instantly share code, notes, and snippets.

@twelverobots
Created March 4, 2014 18:49
Show Gist options
  • Save twelverobots/9353023 to your computer and use it in GitHub Desktop.
Save twelverobots/9353023 to your computer and use it in GitHub Desktop.
<cfxml variable="myXML">
<?xml version="1.0" encoding="UTF-8"?>
<data>
<users>
<user>
<name>Bill</name>
</user>
<user>
<name>Dave</name>
</user>
<user>
<name>Harry</name>
</user>
</users>
</data>
</cfxml>
<cfset users = xmlSearch(myXML, "//user") />
<cfloop array="#users#" index="userIndex">
<cfset user = xmlSearch(userIndex, "//name") />
<cfoutput>
XMLSearch found #arrayLen(user)# &lt;name&gt; elements in this XML : #encodeForHTML(toString(userIndex))#<hr />
<br />
</cfoutput>
</cfloop>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment