tags:

views:

26

answers:

2

Hi,

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?

A: 

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
A: 

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

Check QtWebkit.

OneOfOne