Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] mozilla interfaces and swt.browser widget

Hello, all!

I am trying to get the content of document.body element in SWT.BROWSER widget
According http://www.xulplanet.com/references/xpcomref I wrote such code (this is the most
relevant part):

...

Browser browser = new Browser(shell, SWT.MOZILLA);
nsIWebBrowser webBrowser = (nsIWebBrowser) browser.getWebBrowser();
nsIDOMNSDocument nsHtmlDocument = (nsIDOMNSHTMLDocument)webBrowser.getContentDOMWindow().
                         getDocument().queryInterface(nsIDOMNSHTMLDocument.
                NS_IDOMNSHTMLDOCUMENT_IID);
nsIDOMHTMLBodyElement body = (nsIDOMHTMLBodyElement) htmlDocument.
                   getBody().queryInterface(
                           nsIDOMHTMLBodyElement.
                           NS_IDOMHTMLBODYELEMENT_IID);
nsIAccessNode accessNode = (nsIAccessNode)body.queryInterface(nsIAccessNode.NS_IACCESSNODE_IID);
String bodyContent = accessNode.getInnerHTML();
...

But while querying nsIAccessNode interface i get an exception
org.mozilla.xpcom.XPCOMException: The function "QueryInterface" returned an error condition  
(0x80004002)
Whether my approach is incorrect or problem consist in internal realization of swt.browser?

Thank in advance


-- 
Best regards,
 Vladimir                          mailto:vlads@xxxxxxxx



Back to the top