[Greater-commits] r374 - trunk/Administration

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Jul 7 15:45:20 CEST 2011


Author: bricks
Date: 2011-07-07 15:45:20 +0200 (Thu, 07 Jul 2011)
New Revision: 374

Modified:
   trunk/Administration/ImportDialog.cpp
Log:
Add new DTDEntityResolver so that it will be used during import
Fix several issues:
* print uft-8 encoded strings in error dialogs correctly
* fix handling of unix path, windows path with device where expected
* fix crash with to long filenames


Modified: trunk/Administration/ImportDialog.cpp
===================================================================
--- trunk/Administration/ImportDialog.cpp	2011-07-07 13:38:44 UTC (rev 373)
+++ trunk/Administration/ImportDialog.cpp	2011-07-07 13:45:20 UTC (rev 374)
@@ -19,7 +19,9 @@
 #include "MainWindow.h"
 #include "XMLStringConv.h"
 #include "ConvXMLChar.h"
+#include "DTDEntityResolver.h"
 #include "wx/file.h"
+#include <xercesc/validators/common/Grammar.hpp>
 
 
 #define XMLConv(str) XMLStringConv(str).ConvertToXML()
@@ -386,6 +388,7 @@
   parser->setDoValidation(TRUE);
   parser->setDoNamespaces(TRUE); 
   parser->setDoSchema(TRUE);
+  parser->setXMLEntityResolver(new DTDEntityResolver());
 
   ErrorHandler* errHandler = (ErrorHandler*) new HandlerBase();
   parser->setErrorHandler(errHandler);
@@ -1263,7 +1266,7 @@
         (strcmp(p_catch.name, p_curr_catch->name) == 0))
     {
       //Inform user, that the catchment to import is already existing
-      message = message.Format(wxT("Catchment is already existing and was not imported: %s"), p_catch.name);
+      message = message.Format(wxT("Catchment is already existing and was not imported: %s"), wxString::FromUTF8(p_catch.name).c_str());
       wxMessageBox(message, wxT("Info"), wxOK | wxICON_INFORMATION, this);
       
       //Set Flag to consider for binary objects 
@@ -1276,7 +1279,7 @@
     if (strcmp(p_catch.name, p_curr_catch->name) == 0)
     {
       //Inform user, that the catchment to import is already existing by name
-      message = message.Format(wxT("Catchment is already existing with same name and was not imported: %s"), p_catch.name);
+      message = message.Format(wxT("Catchment is already existing with same name and was not imported: %s"), wxString::FromUTF8(p_catch.name).c_str());
       wxMessageBox(message, wxT("Info"), wxOK | wxICON_INFORMATION, this);
       
       //Set Flag to consider for binary objects 
@@ -1802,7 +1805,7 @@
   wxString           fileName;
   wxString           XMLfileName;
   char               filepath[1000];
-  char               filename[50];
+  char               filename[1000];
   int                pos;
 
   /*
@@ -1820,8 +1823,13 @@
   //Get path + name of XML file from input dialog  
   filePath = textFilePath->GetValue();
   pos = filePath.Find('\\', TRUE);
-  XMLfileName = filePath.Mid(pos+1);
-  filePath = filePath.Mid(0, pos+1);
+  if (pos > 0 ) {
+      XMLfileName = filePath.Mid(pos+1);
+      filePath = filePath.Mid(0, pos+1);
+  }
+  else {
+      XMLfileName = filePath;
+  }
   //Extract File type from file name
   pos = XMLfileName.Find('.', TRUE);
   XMLfileName = XMLfileName.Mid(0, pos);



More information about the Greater-commits mailing list