Set inner HTML using QDomDocument
-
How can I set the inner HTML in a QDomElement?
When I'm using QWebElement I have the method "QWebElement::setInnerXml(const QString & markup)":http://qt-project.org/doc/qt-5.0/qtwebkit/qwebelement.html#setInnerXml, there is some similar method in QDomElement?
-
and why don't you just use this method?!
-
Because the both class are not related!
The both class are used in different contexts. See doc of "QWebElement":http://qt-project.org/doc/qt-5.0/qtwebkit/qwebelement.html and "QDomElement":http://qt-project.org/doc/qt-5.0/qtxml/qdomelement.html
[quote author="raven-worx" date="1367584646"]and why don't you just use this method?![/quote]
-
sorry... seems my brain wasn't completely present :)
QDomElement inherits QDomNode which holds all methods you need.
You first "remove":http://qt-project.org/doc/qt-4.8/qdomnode.html#removeChild all "children ":http://qt-project.org/doc/qt-4.8/qdomnode.html#childNodesand then "append":http://qt-project.org/doc/qt-4.8/qdomnode.html#appendChild the newly created QDomElement into it.QDomNode API isn't that handy in this case. You have to create all child nodes by yourself...
-
That was a bad news.... :P
[quote author="raven-worx" date="1367585147"]sorry... seems my brain wasn't completely present :)
QDomElement inherits QDomNode which holds all methods you need.
You first remove all children and then "append":http://qt-project.org/doc/qt-4.8/qdomnode.html#appendChild the newly created QDomElement into it.QDomNode API isn't that handy in this case. You have to create all child nodes by yourself...[/quote]