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:
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:
Have fun searching your XML!
3 Comments
Daniel Short wrote on 02/13/09 9:21 AM
Yep, it's hacky, but tasty :)Chris Hampton wrote on 08/19/10 3:05 PM
I could buy you a drink right now! I've spent the last two hours looking for a working solution to this problem.
Ben Nadel wrote on 02/13/09 9:11 AM
Local-name() for the win! I used to feel that this was really hacky (and still do a bit), but it the easiest way to deal with it and has helped me out so many times!