Well, I've finally got it working, with the code below. It only works
though when I use a prefix in my XPath expression, for example
"//ws:MasterColumn". Can I use XPath in mozilla without using that
prefix? I'm creating a cross-browser solution, and XPath expressions
with prefixes don't work in IE.
Node.prototype.selectNodes = function(sExpr)
{
//DOCUMENT_NODE = 9
var doc = this.nodeType == 9 ? this : this.ownerDocument;
var nsRes = doc.createNSResolver(this.nodeType == 9 ?
this.documentElement : this);
var nsRes2 = function(s) {
return "http://myservice.com";
}
var xpRes = doc.evaluate(sExpr, this, nsRes2, 5, null);
var res = [];
var item;
while (item = xpRes.iterateNext())
res.push(item);
return res;
|