diff --git a/src/importexport/musicxml/CMakeLists.txt b/src/importexport/musicxml/CMakeLists.txt
index f9882fb776..1e06776c65 100644
--- a/src/importexport/musicxml/CMakeLists.txt
+++ b/src/importexport/musicxml/CMakeLists.txt
@@ -19,9 +19,11 @@
# along with this program. If not, see .
set(MODULE iex_musicxml)
-
set(MODULE_QRC musicxml.qrc)
+find_package(LibXml2 REQUIRED)
+include_directories("${LIBXML2_INCLUDE_DIRS}")
+
include(${CMAKE_CURRENT_LIST_DIR}/internal/musicxml/musicxml.cmake)
set(MODULE_SRC
@@ -41,6 +43,7 @@ set(MODULE_SRC
set(MODULE_LINK
engraving
+ "${LIBXML2_LIBRARIES}"
)
include(SetupModule)
diff --git a/src/importexport/musicxml/internal/musicxml/importxml.cpp b/src/importexport/musicxml/internal/musicxml/importxml.cpp
index dc41844a54..4e51c36832 100644
--- a/src/importexport/musicxml/internal/musicxml/importxml.cpp
+++ b/src/importexport/musicxml/internal/musicxml/importxml.cpp
@@ -31,6 +31,8 @@
//#include
#include "importmxml.h"
+#include
+#include
#include "musicxmlsupport.h"
#include "translation.h"
@@ -66,44 +68,6 @@ static_assert(int(DurationType::V_BREVE) == int(DurationType::V_LONG) + 1
&& int(DurationType::V_512TH) == int(DurationType::V_256TH) + 1
&& int(DurationType::V_1024TH) == int(DurationType::V_512TH) + 1);
-//---------------------------------------------------------
-// initMusicXmlSchema
-// return false on error
-//---------------------------------------------------------
-
-//static bool initMusicXmlSchema(QXmlSchema& schema)
-//{
-// // read the MusicXML schema from the application resources
-// QFile schemaFile(":/schema/musicxml.xsd");
-// if (!schemaFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
-// LOGE("initMusicXmlSchema() could not open resource musicxml.xsd");
-// return false;
-// }
-
-// // copy the schema into a QByteArray and fixup xs:imports,
-// // using a path to the application resources instead of to www.musicxml.org
-// // to prevent downloading from the net
-// QByteArray schemaBa;
-// QTextStream schemaStream(&schemaFile);
-// while (!schemaStream.atEnd()) {
-// QString line = schemaStream.readLine();
-// if (line.contains("xs:import")) {
-// line.replace("http://www.musicxml.org/xsd", "qrc:///schema");
-// }
-// schemaBa += line.toUtf8();
-// schemaBa += "\n";
-// }
-
-// // load and validate the schema
-// schema.load(schemaBa);
-// if (!schema.isValid()) {
-// LOGE("initMusicXmlSchema() internal error: MusicXML schema is invalid");
-// return false;
-// }
-
-// return true;
-//}
-
//---------------------------------------------------------
// musicXMLValidationErrorDialog
//---------------------------------------------------------
@@ -114,18 +78,52 @@ static_assert(int(DurationType::V_BREVE) == int(DurationType::V_LONG) + 1
Return QMessageBox::Yes (try anyway) or QMessageBox::No (don't)
*/
-static int musicXMLValidationErrorDialog(QString text, QString detailedText)
+static int musicXMLValidationErrorDialog(void *ctxt,const char *fmt,...)
{
+ std::string format(fmt);
+ std::string fstr("%s");
+ int count=0;
+ int nPos = format.find(fstr, 0); // fist occurrence
+
+ while (nPos != std::string::npos)
+ {
+ count++;
+ nPos = format.find(fstr, nPos + 1);
+ }
+
QMessageBox errorDialog;
+ std::va_list argp;
+ va_start(argp, fmt);
+ std::string detailedError;
+ for(int i=0;i 0)
+ {
+ std::cout <<"fails to validate"<< name.toStdString() << "\n";
+ error = Err::FileCorrupted;
+ }
+ else
+ {
+ std::cout <<"fails to validate internal error" << "\n";
+ error = Err::UnknownError;
+
+ }
+ xmlSchemaFreeValidCtxt(ctxt);
+ xmlFreeDoc(doc);
+ }
+
+
+ if(schema != NULL)
+ xmlSchemaFree(schema);
+
+ xmlSchemaCleanupTypes();
+ xmlCleanupParser();
+ xmlMemoryDump();
+
+ return error;
}
//---------------------------------------------------------