1

I'm trying to use the khtml library, basically just the DOM html implementation from there, but I even failed to create a basic HTMLDocument from a file using load(), and when I tried to create a HTMLDOcument by mutating it via appendChild I get DOMException with errorcode == 8 (NOT FOUND).

Can anyone please point me to some sample code which uses khtml's dom model without obtaining the document from the GUI components?

Mykola
  • 3,343
  • 6
  • 23
  • 39
A. Novikov
  • 11
  • 1

2 Answers2

0

Ok, I see what the problem was.

First, if you're using a local html file, your uri needs to be absolute when you call DOM::HTMLDocumemt::load(const DOM::DOMString&).

Secondly, you need to create a DOM document, but it's read-only by default after creation. So, before you actually call load(), you need to make it editable via

DOM::Document::setDesignMode(bool designOn).

That fixes it.

A. Novikov
  • 11
  • 1
0

If I may recommend, WebKit is far superior to khtml now, even konqueror will be using webkit by default next release.

Check QtWebkit.

OneOfOne
  • 95,033
  • 20
  • 184
  • 185
  • As far as I know QtWebKit requires you to run X11. For a server that's not a good option. – Alexis Wilke Sep 21 '14 at 22:00
  • 1
    @AlexisWilke it doesn't require you to run X11, the widget part of it requires being linked against x11. It works fine without X running. – OneOfOne Sep 21 '14 at 22:43