XMLSearch and empty arrays with namespaces

I ran into an odd issue today and I'm documenting it here for my own future knowledge. When searching an XML document with defined namespaces on elements, XMLSearch wasn't returning any results. Take the following example:

Dan Short 5 Angela Buraglia 10

The result of this is unexciting...

XPathFirstRun.png

The array should have all of the results from my person search. Unfortunately the namespace is mucking everything up... A little Google searching got me to a post from Jeremy Gibbens showing how to get around the namespace issue. You need to search by the local name of the node instead, like so:

<cfdump *[local-name()="person" ]")#"="" label="Result of XML Search" var="#XMLSearch(xml, ">

This gives a much more satisfying result:

XMLPathSecondRound.png

Have fun searching your XML!