DOM Level 2 specification defines a new series of methods to be used with XML namespaces (though, in theory, they should work also in XHTML). Methods such as getElementsByTagNameNS()
or getAttributeNS()
are really handy when dealing with complex XML documents featuring several namespaces. They basically accept a namespace URL and a local name by which we can get/set our elements or resources.
However, browser support is, as always, cut in half: on one side, there are Firefox, Safari, Opera and Chrome which all support the aforementioned features; on the other side, instead, there is Internet Explorer that, at the time of writing, doesn't support these features. So what? I've followed the IE9 preview but I only read about the support of the DOM standard event model. Nothing about DOM Level 2 namespace methods. I tried to test something with jQuery ($(element).find(element)
). and I have to say that in some cases it works just well, but I didn't dig deep into the details of more complex XML documents. So I need more time to say if jQuery (and its related plugins) are a feasibile alternative when dealing with namespaces in a cross-browser way.