KHTMLPart::document seems to return nothing ...

Jan.Kaiser at OnVista.de Jan.Kaiser at OnVista.de
Wed Jun 4 15:50:19 BST 2003


Hi,

thanks for all the help. The creation if KHTMLPart works now without the
GUI==false flag.
If I invoke the KHTMLPart::show() method, even a "browser" window co
But unfortunately there is another problem regarding the retrieval of the
DOM::Document by invoking
the KHTMLPart::document method. This call seems to return nothing.

Is there a special (e.g. signal/slot) mechanism required to access the
document?

int main(int argc, char* argv[])
{

  KApplication a(argc, argv, "test");
  cerr << "created KApplication" << endl;
  KURL url = KURL("http://www.kde.org/index.php");
  cerr << "created KURL" << endl;
  KHTMLPart *w = new KHTMLPart(0,0,0,0,KHTMLPart::BrowserViewGUI);
  cerr << "created KHTMLPart" << endl;
  if (w != 0)
  {
    bool opened = w->openURL(url);
    cerr << "opened url: " << opened << endl;
    Document doc = w->document();
    // this prints nothing for the doc.toHTML() expression
    cerr << "got doc " << doc.toHTML() << endl;
  }
  else
    cerr << "w is null" << endl;
  return a.exec();
}






More information about the kfm-devel mailing list