Re: Node.prototype.selectNodes function problems
| Newsgroups | gmane.comp.mozilla.devel.xml |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <[email protected]> |
Okay, I've studied sarissa, it needs an array with namespaces and a
binding function. I've tried this, in a quick and dirty solution, but
the code below still doesn't work:
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);
doc._namespaces = {};
doc._namespaces["soap"] =
"http://schemas.xmlsoap.org/soap/envelope/";
doc._namespaces["xsi"] = "http://www.w3.org/2001/XMLSchema-instance";
doc._namespaces["xsd"] = "http://www.w3.org/2001/XMLSchema";
var nsRes2 = function(s)
{
return doc._namespaces[s];
}
var xpRes = doc.evaluate(sExpr, this, nsRes2, 5, null);
var res = [];
var item;
while (item = xpRes.iterateNext())
res.push(item);
return res;
}