Re: How to call WebKit.DOMDocument.evaluate function in python
- From: Niranjan Rao <nhrdls gmail com>
- To: Simon Feltman <s feltman gmail com>
- Cc: gtk-app-devel-list <gtk-app-devel-list gnome org>
- Subject: Re: How to call WebKit.DOMDocument.evaluate function in python
- Date: Tue, 02 Jul 2013 17:12:10 -0700
Simon,
Thanks for the pointer. I noticed that I made a stupid mistake and was
sending document as a first parameter.
Your example opened my eyes and now it looks like its running ok.
Thanks,
Niranjan
On 07/02/2013 02:37 PM, Simon Feltman wrote:
On Tue, Jul 2, 2013 at 10:35 AM, Niranjan Rao <nhrdls gmail com
<mailto:nhrdls gmail com>> wrote:
And yes, I had tried creating empty WebKit.DOMXPathResult object
and passing it. Did not work.
It would be helpful to know the details of what didn't work. Code
examples of what you have tried, or steps to reproduce the problems
you are seeing can be invaluable for getting help. A simple example on
my system shows using an empty DOMXPathResult is actually working:
In [1]: from gi.repository import WebKit
In [2]: view = WebKit.WebView()
In [3]: dom = view.get_dom_document()
In [4]: dom.evaluate('/', dom, WebKit.DOMXPathNSResolver(), 0,
WebKit.DOMXPathResult())
Out[4]: <DOMXPathResult object at 0x7fc670b08eb0 (WebKitDOMXPathResult
at 0x2ea90f0)>
This is with PyGObject/GTK+ version 3.8.2 (not sure about WebKit
version). If this does not work with older versions, supporting a
fallback with ctypes hacks sounds reasonable. This would allow support
for older versions while ensuring use of proper API on newer versions.
If the __gpointer__ attribute is not available or not useful, you can
still find the pointer to the GObject by using offsets of the pointer
field on the PyGObject wrapper. But code examples of what you have
already tried will be needed to further aid you with this.
-Simon
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]