Qt's QXmlQuery::setQuery has a polymorphism, just like:
void QXmlQuery::setQuery(const QString &sourceCode, const QUrl &documentURI = QUrl())
However, when I pass a HTML source code to the parameter sourceCode
, and try to evaluate, I can only get an error:
Error XPST0003 in file:///, at line 1, column 2: syntax error, unexpected unknown keyword, expecting QName or NCName
Here is an example:
QString srcHTML = "<html>......</html>"; // An HTML forked from any website
QXmlQuery query;
query.setQuery(srcHTML, QUrl("/html/body/"));
QString r;
query.evaluateTo(&r);
qDebug() << r;
Then an error message shows:
Error XPST0003 in file:///html/body/, at line 1, column 2: syntax error, unexpected unknown keyword, expecting QName or NCName ""
That's strange, even though I've feeded QXmlQuery::setQuery() a valid HTML source!