xpath and thunderbird

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

xpath and thunderbird

mozilla.org
Hi -

I'm trying to do is use xpath from within thunderbird.  What I'm
finding is that the document.evaluate() method doesn't exist.

I posted a similar message to dev-apps-thunderbird yesterday, but I've
since put together some test cases (below) and also realised that this
list is probably more appropriate anyway.

Unless I'm doing something silly, I wonder whether there might be a
configure/build-time bug, as the symptoms are similar to this thread
from 2005 which reported a similar problem with sunbird:
http://groups.google.com/group/netscape.public.mozilla.xml/browse_thread/thread/7d736646ffa76d69
In that case, the resulting bug has since been fixed:
https://bugzilla.mozilla.org/show_bug.cgi?id=306701

Anyway, if someone can suggest a workaround I'd be grateful, otherwise
I'll have to rewrite my xpath code (developed under xulrunner) to use
getElementsByTagNameNS.

Thanks -

Leni.

Here are some test cases which suggest that xpath isn't available from
within thunderbird 1.5.x or 2.0 beta.  The test case behaviour doesn't
change whether the code is run from within an extension or within a
Javascript Shell - I'm using the one bundled with:
ted.mielczarek.org/code/mozilla/extensiondev/

Test Case One - xpath
=====================
   var parser = new DOMParser();
   var xmldoc = parser.parseFromString("<hello/>", "text/xml");
   dump("xmldoc.evaluate() is " + typeof(xmldoc.evaluate) + "\n");
   // prints "function" when run from within mozilla but
   // prints "undefined" when run from within thunderbird
   // 1.5.x or 2.0 beta.

Test Case Two - xpointer xpath() scheme
=======================================
  // test the xpointer xpath1() scheme
  // based on the example from http://www.w3.org/TR/xptr-xmlns/
  //
  var parser = new DOMParser();
  var xmldoc = parser.parseFromString("<customer
    xmlns='http://example.org/customer'><name
    xmlns='http://example.org/personal-info'>
    John Doe</name></customer>", "text/xml");
  var result =
   xmldoc.evaluateXPointer("xmlns(c=http://example.org/customer)
   xmlns(p=http://example.org/personal-info)
   xpath1(/c:customer/p:name)");
  print(result);
  // prints [object XPointerResult] when run from mozilla
  // prints null                    when run from thunderbird
  // but as an aside I noticed that the element() scheme works ok
  //  in thunderbird

And this last test isn't really a test case, just a bit more
information that might point to what is going on.

Test Case Three - category manager
==================================
  var catman = Components.classes["@mozilla.org/categorymanager;1"].
     getService(Components.interfaces.nsICategoryManager);
  var item   = catman.enumerateCategory("JavaScript DOM class");
  while (item.hasMoreElements()) {
    var subitem = item.getNext();
    var tmp = subitem.
       QueryInterface(Components.interfaces.nsISupportsCString).data;
    print("\t" + tmp + "\n");
  }
  // in thunderbird 2.0 beta prints:
  //    XPointerResult
  //
  // in mozilla, prints:
  //    XPathEvaluator
  //    XPathException
  //    XPathExpression
  //    XPathNSResolver
  //    XPathResult
  //    XPointerResult
  //    XSLTProcessor

_______________________________________________
dev-tech-xml mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xml
Reply | Threaded
Open this post in threaded view
|

Re: xpath and thunderbird

Boris Zbarsky
[hidden email] wrote:
> I posted a similar message to dev-apps-thunderbird yesterday, but I've
> since put together some test cases (below) and also realised that this
> list is probably more appropriate anyway.

Nope.  The other list seems to be the right one....

> Unless I'm doing something silly, I wonder whether there might be a
> configure/build-time bug

I don't know about "bug", but it's a configure issue for sure -- the default
extensions list for thunderbird on branch does not include "transformiix", which
means no XSLT or XPath in Thunderbird.

You might want to file a Thuderbird bug about that...

-Boris
_______________________________________________
dev-tech-xml mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xml
Reply | Threaded
Open this post in threaded view
|

Re: xpath and thunderbird

mozilla.org
Boris Zbarsky wrote:
> I don't know about "bug", but it's a configure issue for sure -- the
> default extensions list for thunderbird on branch does not include
> "transformiix", which means no XSLT or XPath in Thunderbird.
>
> You might want to file a Thuderbird bug about that...

Done:
https://bugzilla.mozilla.org/show_bug.cgi?id=370345

Leni.

_______________________________________________
dev-tech-xml mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xml
Reply | Threaded
Open this post in threaded view
|

Re: xpath and thunderbird

Philip Chee
In reply to this post by Boris Zbarsky
On Wed, 14 Feb 2007 16:18:49 +1100, [hidden email] wrote:
> Boris Zbarsky wrote:

>> I don't know about "bug", but it's a configure issue for sure -- the
>> default extensions list for thunderbird on branch does not include
>> "transformiix", which means no XSLT or XPath in Thunderbird.

>> You might want to file a Thuderbird bug about that...

> Done:
> https://bugzilla.mozilla.org/show_bug.cgi?id=370345

It might be possible to get this working in Thunderbird since it's
written in pure .js: <http://xpointerlib.mozdev.org/>

Phil

--
Philip Chee <[hidden email]>, <[hidden email]>
http://flashblock.mozdev.org/ http://xsidebar.mozdev.org
Guard us from the she-wolf and the wolf, and guard us from the thief,
oh Night, and so be good for us to pass.
[ ]Never test for an error you don't know how to handle!
* TagZilla 0.059.4
_______________________________________________
dev-tech-xml mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xml