We abuse the QWebFrame as a html parser
QString html = "<img src=\"input_213123dfh\" />";
QWebFrame* frame = htmlProcessor.mainFrame();
frame->setHtml(html);
QWebElementCollection inputs = frame->documentElement().findAll("img[src*=input_]");
foreach (QWebElement input, inputs) {
input.setOuterXml(QString("<input type=\"text\" uuid=\"%1\" />").arg(input.attribute("src").section("_",1,1)));
}
html = frame->toHtml();
which outputs
<html><head></head><body><input type="text" uuid="213123dfh"></body></html>
our Problem is that the input tag in the output is not self-closing. Is it possible to get html with self-closed tags?