XPath expression prefixes
| Newsgroups | gmane.comp.mozilla.devel.xml |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <[email protected]> |
<<Continued from yesterday>>
I finally have my selectNodes function working. The only problem is
that I always have to use a prefix in my XPath expression, for example
"//ws:MasterRow". This prefix causes problems in IE however. Can I use
XPath in Mozilla on a Soap document without using prefixes in my XPath
expression?
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 ;
}