void QHelpProjectDataPrivate::readProject() { while (!atEnd()) { readNext(); if (isStartElement()) { if (name() == QLatin1String("virtualFolder")) { virtualFolder = readElementText(); if (virtualFolder.contains(QLatin1String("/"))) raiseError(QObject::tr("A virtual folder must not contain a \'/\' character!")); } else if (name() == QLatin1String("namespace")) { namespaceName = readElementText(); if (namespaceName.contains(QLatin1String("/"))) raiseError(QObject::tr("A namespace must not contain a \'/\' character!")); } else if (name() == QLatin1String("customFilter")) { readCustomFilter(); } else if (name() == QLatin1String("filterSection")) { readFilterSection(); } else if (name() == QLatin1String("metaData")) { QString n = attributes().value(QLatin1String("name")).toString(); if (!metaData.contains(n)) metaData[n] = attributes().value(QLatin1String("value")).toString(); else metaData.insert(n, attributes().value(QLatin1String("value")).toString()); } else { raiseUnknownTokenError(); } } else if (isEndElement() && name() == QLatin1String("QtHelpProject")) { if (namespaceName.isEmpty()) raiseError(QObject::tr("Missing namespace in QtHelpProject.")); else if (virtualFolder.isEmpty()) raiseError(QObject::tr("Missing virtual folder in QtHelpProject")); break; } } }
void QHelpProjectDataPrivate::readProject() { while (!atEnd()) { readNext(); if (isStartElement()) { if (name() == QLatin1String("virtualFolder")) { virtualFolder = readElementText(); if (!hasValidSyntax(QLatin1String("test"), virtualFolder)) raiseError(QCoreApplication::translate("QHelpProject", "Virtual folder has invalid syntax in file: \"%1\"").arg(fileName)); } else if (name() == QLatin1String("namespace")) { namespaceName = readElementText(); if (!hasValidSyntax(namespaceName, QLatin1String("test"))) raiseError(QCoreApplication::translate("QHelpProject", "Namespace \"%1\" has invalid syntax in file: \"%2\"").arg(namespaceName, fileName)); } else if (name() == QLatin1String("customFilter")) { readCustomFilter(); } else if (name() == QLatin1String("filterSection")) { readFilterSection(); } else if (name() == QLatin1String("metaData")) { QString n = attributes().value(QLatin1String("name")).toString(); if (!metaData.contains(n)) metaData[n] = attributes().value(QLatin1String("value")).toString(); else metaData.insert(n, attributes(). value(QLatin1String("value")).toString()); } else { raiseUnknownTokenError(); } } else if (isEndElement() && name() == QLatin1String("QtHelpProject")) { if (namespaceName.isEmpty()) raiseError(QCoreApplication::translate("QHelpProject", "Missing namespace in QtHelpProject file: \"%1\"").arg(fileName)); else if (virtualFolder.isEmpty()) raiseError(QCoreApplication::translate("QHelpProject", "Missing virtual folder in QtHelpProject file: \"%1\"").arg(fileName)); break; } } }