views:

148

answers:

1

Using Qt 4.6, I can dynamically add to an HTML page like this:

ui->webView->page()->mainFrame()->documentElement().findFirst("body").appendInside("<i>some text</i>\n");

However, if I QWebView::load() an XML file, it displays it with the correct CSS styling (from an processing instruction), but doesn't show any changes when I do something like:

ui->webView->page()->mainFrame()->documentElement().findFirst("lines").appendInside("<line>hello</line>\n");

Why is it treating them differently, and is there a way to modify an XML document in the same way I can an HTML one?

A: 

Try using setUrl() rather than load(). If that magically works it's a bug.

James Oltmans
That doesn't work. I'm just going to use HTML instead of XML.
Dan Ellis
That's probably best if you can swing it. I think this might be Qt not handling the differences between styled XML and (X)HTML. It could be that some of the core assumptions for this object are wrong for XML.Out of curiousity have you tried ui->webView->page()->mainFrame()->findFirstElement rather than using the documentElement?
James Oltmans