# HG changeset patch # User insilmaril # Date 1241603408 0 # Node ID 6c6aa8d5e9b65bd837bc389f785dd7f8b400a97b # Parent c4893070033f070d29a237de46ffcf411aec4202 Fixed wrong linenumber in error message of XML parser diff -r c4893070033f -r 6c6aa8d5e9b6 version.h --- a/version.h Wed Apr 08 12:02:07 2009 +0000 +++ b/version.h Wed May 06 09:50:08 2009 +0000 @@ -7,7 +7,7 @@ #define __VYM_VERSION "1.12.2h" #define __VYM_CODENAME "Maintenance Update " //#define __VYM_CODENAME "Codename: development version" -#define __VYM_BUILD_DATE "2009-04-08" +#define __VYM_BUILD_DATE "2009-05-06" bool checkVersion(const QString &); diff -r c4893070033f -r 6c6aa8d5e9b6 xml-base.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml-base.cpp Wed May 06 09:50:08 2009 +0000 @@ -0,0 +1,106 @@ +#include "xml-base.h" + +#include +#include +#include +#include + +#include "misc.h" +#include "settings.h" +#include "linkablemapobj.h" + +/* +static BranchObj *lastBranch; +static FloatObj *lastFloat; +static OrnamentedObj *lastOO; + +extern Settings settings; +extern QString vymVersion; +*/ + +parseBaseHandler::parseBaseHandler() {} + +parseBaseHandler::~parseBaseHandler() {} + +QString parseBaseHandler::errorProtocol() { return errorProt; } + + +/* +bool parseBaseHandler::startDocument() +{ + errorProt = ""; + state = StateInit; + laststate = StateInit; + stateStack.clear(); + stateStack.append(StateInit); + branchDepth=0; + htmldata=""; + isVymPart=false; + return true; +} +*/ + +QString parseBaseHandler::parseHREF(QString href) +{ + QString type=href.section(":",0,0); + QString path=href.section(":",1,1); + if (!tmpDir.endsWith("/")) + return tmpDir + "/" + path; + else + return tmpDir + path; +} + + +/* +QString parseBaseHandler::errorString() +{ + return "the document is not in the VYM file format"; +} +*/ + +bool parseBaseHandler::fatalError( const QXmlParseException& exception ) +{ + errorProt += QString( "Fatal parsing error: %1 in line %2, column %3\n") + .arg( exception.message() ) + .arg( exception.lineNumber() ) + .arg( exception.columnNumber() ); + // Try to read the bogus line + errorProt+=QString("File is: %1\n").arg(inputFile); + QString s; + if (loadStringFromDisk (inputFile,s)) + { + QStringList sl=QStringList::split ("\n",s); + int i=1; + QStringList::Iterator it = sl.begin(); + while (i"); + errorProt+=s; + } + return QXmlDefaultHandler::fatalError( exception ); +} + +void parseBaseHandler::setModel (VymModel *m) +{ + model=m; +} + +void parseBaseHandler::setTmpDir (QString tp) +{ + tmpDir=tp; +} + +void parseBaseHandler::setInputFile (QString f) +{ + inputFile=f; +} + +void parseBaseHandler::setLoadMode (const LoadMode &lm) +{ + loadMode=lm; +} +