Hello,
Now I'm trying to get the DOM document by using 'embedding project'.
In the sample embedding of Mozilla source tree, "WinEmbed",
I wrote the part in order to get the DOM document.
But there is a problem. nsIDOMDocument 'doc' have just four nodes,
'#DOCUMENT', 'HTML', 'HEAD' and 'BODY'.
that is, just a empty DOM document.
Maybe my method to obtain the DOM seems wrong.
Please help me~ :)
nsresult OpenWebPage(const char *url)
{
nsresult rv;
// Create the chrome object. Note that it leaves this function
// with an extra reference so that it can released correctly during
// destruction (via Win32UI::Destroy)
nsCOMPtr<nsIWebBrowserChrome> chrome;
rv = AppCallbacks::CreateBrowserWindow(
nsIWebBrowserChrome::CHROME_DEFAULT,
nsnull, getter_AddRefs(chrome));
// Start loading a page
nsCOMPtr<nsIWebBrowser> newBrowser;
chrome->GetWebBrowser(getter_AddRefs(newBrowser));
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(newBrowser));
webNav->LoadURI(NS_ConvertASCIItoUCS2(url).get(),
nsIWebNavigation::LOAD_FLAGS_NONE,
nsnull,
nsnull,
nsnull);
////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
// to get the DOM
////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
nsCOMPtr<nsIDOMDocument> doc;
nsCOMPtr<nsIDOMWindow> window;
rv = newBrowser->GetContentDOMWindow(getter_AddRefs(window));
if ( NS_FAILED( rv ) )
return rv;
rv = window->GetDocument(getter_AddRefs(doc));
if ( NS_FAILED( rv ) )
return rv;
...
...
...
_______________________________________________
mozilla-embedding mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-embedding