25 #include <QXmlStreamAttributes>
26 #include <QXmlStreamReader>
28 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
41 QString quotedMessage(message);
42 quotedMessage.replace(
"&",
"&");
43 quotedMessage.replace(
"\"",
""");
44 quotedMessage.replace(
"'",
"'");
45 quotedMessage.replace(
"<",
"<");
46 quotedMessage.replace(
">",
">");
52 QString quotedMessage(message);
53 quotedMessage.replace(
"&",
"&");
54 quotedMessage.replace(
""",
"\"");
55 quotedMessage.replace(
"'",
"'");
56 quotedMessage.replace(
"<",
"<");
57 quotedMessage.replace(
">",
">");
64 file.setFileName(filename);
65 const bool succeed = file.open(QIODevice::ReadOnly | QIODevice::Text);
69 QXmlStreamReader reader(&file);
70 while (!reader.atEnd()) {
71 switch (reader.readNext()) {
72 case QXmlStreamReader::StartElement:
74 QXmlStreamAttributes attribs = reader.attributes();
76 const int ver = attribs.value(QString(),
VersionAttribute).toString().toInt();
84 case QXmlStreamReader::EndElement:
85 case QXmlStreamReader::NoToken:
86 case QXmlStreamReader::Invalid:
87 case QXmlStreamReader::StartDocument:
88 case QXmlStreamReader::EndDocument:
89 case QXmlStreamReader::Characters:
90 case QXmlStreamReader::Comment:
91 case QXmlStreamReader::DTD:
92 case QXmlStreamReader::EntityReference:
93 case QXmlStreamReader::ProcessingInstruction:
A base class for reports.
XmlReport(const QString &filename)
static QString quoteMessage(const QString &message)
Quote the message.
static QString unquoteMessage(const QString &message)
Unquote the message.
static int determineVersion(const QString &filename)
Get the XML report format version from the file.
static constexpr char ResultElementName[]
static constexpr char VersionAttribute[]