From 34aa4bbedea6451be77369f91aae89fa9af81d74 Mon Sep 17 00:00:00 2001 From: Cyril Jacquet Date: Sun, 15 Nov 2020 19:07:59 +0100 Subject: [PATCH] - add separator handling in Plume importer --- .../src/tasks/sql/plmimporter.cpp | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/libskribisto-data/src/tasks/sql/plmimporter.cpp b/src/libskribisto-data/src/tasks/sql/plmimporter.cpp index 02e5a1a6e..3baf5afa6 100644 --- a/src/libskribisto-data/src/tasks/sql/plmimporter.cpp +++ b/src/libskribisto-data/src/tasks/sql/plmimporter.cpp @@ -433,6 +433,11 @@ SKRResult PLMImporter::importPlumeCreatorProject(const QUrl& plumeFileName, cons } } + while (xml.readNext() != QXmlStreamReader::EndDocument){ + + } + + } IFKO(result) { @@ -440,7 +445,7 @@ SKRResult PLMImporter::importPlumeCreatorProject(const QUrl& plumeFileName, cons return result; } - if (xml.hasError()) { + if (xml.hasError() && xml.error() != QXmlStreamReader::PrematureEndOfDocumentError) { result = SKRResult(SKRResult::Critical, this, "error_in_tree_xml"); result.addData("xmlError", QString("%1\nLine %2, column %3") @@ -508,16 +513,27 @@ SKRResult PLMImporter::readXMLRecursivelyAndCreatePaper(int return result; } else { - IFOKDO(result, this->createPapersAndAssociations(projectId, indent, *xml, tempDirPath)); - IFOKDO(result, readXMLRecursivelyAndCreatePaper(projectId, indent + 1, xml, tempDirPath)); + if(xml->name() == "separator"){ + xml->skipCurrentElement(); + } + else { + IFOKDO(result, this->createPapersAndAssociations(projectId, indent, *xml, tempDirPath)); + IFOKDO(result, readXMLRecursivelyAndCreatePaper(projectId, indent + 1, xml, tempDirPath)); + } } while (xml->readNextStartElement()) { + if(xml->name() == "separator"){ + xml->skipCurrentElement(); + continue; + } IFOKDO(result, this->createPapersAndAssociations(projectId, indent, *xml, tempDirPath)); IFOKDO(result, readXMLRecursivelyAndCreatePaper(projectId, indent + 1, xml, tempDirPath)); } + + return result; }