diff options
Diffstat (limited to 'src/corelib/serialization/qxmlstreamparser_p.h')
-rw-r--r-- | src/corelib/serialization/qxmlstreamparser_p.h | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/corelib/serialization/qxmlstreamparser_p.h b/src/corelib/serialization/qxmlstreamparser_p.h index d568f9d024..9a46bdedac 100644 --- a/src/corelib/serialization/qxmlstreamparser_p.h +++ b/src/corelib/serialization/qxmlstreamparser_p.h @@ -80,6 +80,8 @@ bool QXmlStreamReaderPrivate::parse() { // cleanup currently reported token + using namespace Qt::StringLiterals; + switch (type) { case QXmlStreamReader::StartElement: name.clear(); @@ -467,9 +469,9 @@ bool QXmlStreamReaderPrivate::parse() dtdAttribute.attributePrefix = addToStringStorage(symPrefix(1)); dtdAttribute.attributeName = addToStringStorage(symString(1)); dtdAttribute.attributeQualifiedName = addToStringStorage(symName(1)); - dtdAttribute.isNamespaceAttribute = (dtdAttribute.attributePrefix == QLatin1String("xmlns") + dtdAttribute.isNamespaceAttribute = (dtdAttribute.attributePrefix == "xmlns"_L1 || (dtdAttribute.attributePrefix.isEmpty() - && dtdAttribute.attributeName == QLatin1String("xmlns"))); + && dtdAttribute.attributeName == "xmlns"_L1)); if (lastAttributeValue.isNull()) { dtdAttribute.defaultValue.clear(); } else { @@ -576,7 +578,7 @@ bool QXmlStreamReaderPrivate::parse() processingInstructionTarget = symString(3); if (scanUntil("?>")) { processingInstructionData = XmlStringRef(&textBuffer, pos, textBuffer.size() - pos - 2); - if (!processingInstructionTarget.view().compare(QLatin1String("xml"), Qt::CaseInsensitive)) { + if (!processingInstructionTarget.view().compare("xml"_L1, Qt::CaseInsensitive)) { raiseWellFormedError(QXmlStream::tr("XML declaration not at start of document.")); } else if (!QXmlUtils::isNCName(processingInstructionTarget)) @@ -591,7 +593,7 @@ bool QXmlStreamReaderPrivate::parse() case 97: setType(QXmlStreamReader::ProcessingInstruction); processingInstructionTarget = symString(3); - if (!processingInstructionTarget.view().compare(QLatin1String("xml"), Qt::CaseInsensitive)) + if (!processingInstructionTarget.view().compare("xml"_L1, Qt::CaseInsensitive)) raiseWellFormedError(QXmlStream::tr("Invalid processing instruction name.")); break; @@ -749,13 +751,13 @@ bool QXmlStreamReaderPrivate::parse() case 229: { XmlStringRef prefix = symPrefix(1); - if (prefix.isEmpty() && symString(1) == QLatin1String("xmlns") && namespaceProcessing) { + if (prefix.isEmpty() && symString(1) == "xmlns"_L1 && namespaceProcessing) { NamespaceDeclaration &namespaceDeclaration = namespaceDeclarations.push(); namespaceDeclaration.prefix.clear(); const XmlStringRef ns(symString(5)); - if (ns.view() == QLatin1String("http://www.w3.org/2000/xmlns/") || - ns.view() == QLatin1String("http://www.w3.org/XML/1998/namespace")) + if (ns.view() == "http://www.w3.org/2000/xmlns/"_L1 || + ns.view() == "http://www.w3.org/XML/1998/namespace"_L1) raiseWellFormedError(QXmlStream::tr("Illegal namespace declaration.")); else namespaceDeclaration.namespaceUri = addToStringStorage(ns); @@ -799,16 +801,16 @@ bool QXmlStreamReaderPrivate::parse() attribute.value.pos = pos; attribute.value.len = n; } - if (prefix == QLatin1String("xmlns") && namespaceProcessing) { + if (prefix == "xmlns"_L1 && namespaceProcessing) { NamespaceDeclaration &namespaceDeclaration = namespaceDeclarations.push(); XmlStringRef namespacePrefix = symString(attribute.key); XmlStringRef namespaceUri = symString(attribute.value); attributeStack.pop(); - if (((namespacePrefix == QLatin1String("xml")) - ^ (namespaceUri == QLatin1String("http://www.w3.org/XML/1998/namespace"))) - || namespaceUri == QLatin1String("http://www.w3.org/2000/xmlns/") + if (((namespacePrefix == "xml"_L1) + ^ (namespaceUri == "http://www.w3.org/XML/1998/namespace"_L1)) + || namespaceUri == "http://www.w3.org/2000/xmlns/"_L1 || namespaceUri.isEmpty() - || namespacePrefix == QLatin1String("xmlns")) + || namespacePrefix == "xmlns"_L1) raiseWellFormedError(QXmlStream::tr("Illegal namespace declaration.")); namespaceDeclaration.prefix = addToStringStorage(namespacePrefix); |