QDomDocument fails to set content of an HTML document with <!doctype> tag
问题 When I use QDomDocument with HTML content, it fails to set content if there is a <!doctype html> at the beginning of the document. But actually why?! for example consider the following snippet of code: QDomDocument doc; QString content = "<!doctype html><html><body><a href='bar'>foo</a></body></html>"; qDebug() << doc.setContent(content,false,0,0); QDomElement docElem = doc.documentElement(); QDomNode a = docElem.firstChild(); qDebug() << doc.childNodes().size() << docElem.childNodes().size()