I\'m new to jQuery and would like to parse an XML document.
I\'m able to parse regular XML with the default namespaces but with XML such as:
As mentioned above, there are problems with the above solution with current browsers/versions of jQuery - the suggested plug-in doesn't completely work either because of case issues (nodeName
, as a property, is sometimes in all upper case). So, I wrote the following quick function:
$.findNS = function (o, nodeName)
{
return o.children().filter(function ()
{
if (this.nodeName)
return this.nodeName.toUpperCase() == nodeName.toUpperCase();
else
return false;
});
};
Example usage:
$.findNS($(xml), 'x:row');