Re: Node.prototype.selectNodes function problems

"[email protected]" <[email protected]>
Newsgroups gmane.comp.mozilla.devel.xml
Organization http://groups.google.com
Message-ID <[email protected]>
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.node­Type == 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;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.