The best practice for selecting a namespaced XML element is to specify the namespace, not to ignore it via any sort of "wildcard" mechanism.
For compliant XPath processors, there is always a mechanism to allow the binding of a namespace prefix (eg: ab
) to a namespace URI (eg: http://something.com/xyz
). It is not even necessary to use the same namespace prefix (ab
) as is being used in the source XML; only the namespace URI (http://something.com/xyz
) must match. The only challenge, however, is that XPath itself does not have a mechanism for binding namespace prefixes to namespace URIs. How to do so is dependent upon the facilities offered by the library (eg: libxml2, javax.xml.xpath, etc) or hosting language (eg: XSLT).
In order to provide a pure XPath answer, or sometimes because of (commonly irrational) aversion to namespaces, you'll sometimes see a wildcard mechanism used. A common wildcard mechanism is to use local-name()
to only reference the local name (eg: SomeProcessResponse
) independent of the namespace. The problem with this is that not only does it bypass the namespace prefix (eg: ab
), it also bypasses the namespace URI (http://something.com/xyz
), and the namespace URI is integral to the name and an important part of associating other facilities with the element. Such other facilities include validation and OO class mappings, for example.
So, yes, there are wildcard mechanisms for dodging namespaces, but the best practice is to use the facilities of the hosting language/library to associate namespace prefixes with namespace URIs, not to avoid namespaces via wildcards.