[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-edu-devel
Subject:    Re: [kde-edu-devel] Data files for KVocTrain
From:       Ewald Arnold <kvoctrain () ewald-arnold ! de>
Date:       2002-04-21 13:35:56
[Download RAW message or body]

Hello Scott,

> possibly was an issue with capitalization -- who knows or cares?  It works

capitalisation and possibly "processingInstruction()", didn't check afterwards

> I just tried to read a kvtml file generated with FlashKard with KVocTrain
> and it only sees the first entry.  Did you ever get this working properly? 

it worked fine with several files. I just tried all the files from our new 
contrib directory and all but one was processed immediately. The other had 
attributes which were not correctly escaped as "<" should change to &lt; (mea 
culpa :-) but this worked for kvoc:

  author="Matthias Ansorg <aNsis@gmx.de>"> 

I had to add an error handler to find this out. I consider it a good idea to 
keep this some way :-) Finding such issues is a hard task otherwise.

It is just a quick hack and needs certainly some improvement.

<snip>

class FlashKardErrorHandler : public QXmlErrorHandler
{
public:
    virtual bool warning( const QXmlParseException& exception );
    virtual bool error( const QXmlParseException& exception );
    virtual bool fatalError( const QXmlParseException& exception );
    virtual QString errorString() { return saved_string; }

 private:
    QString saved_string;
};

bool FlashKardErrorHandler::warning( const QXmlParseException& exception )
{
  QString format = "Warning \"%1\" occured in line %2";
  saved_string = format.arg(exception.message()).arg(exception.lineNumber());
  KMessageBox::sorry(0, saved_string);
  return false;
}

bool FlashKardErrorHandler::error( const QXmlParseException& exception )
{
  QString format = "Error \"%1\" occured in line %2";
  saved_string = format.arg(exception.message()).arg(exception.lineNumber());
  KMessageBox::sorry(0, saved_string);
  return false;
}

bool FlashKardErrorHandler::fatalError( const QXmlParseException& exception )
{
  QString format = "Fatal error \"%1\" occured in line %2";
  saved_string = format.arg(exception.message()).arg(exception.lineNumber());
  KMessageBox::sorry(0, saved_string);
  return false;
}

...

 reader.setErrorHandler(new FlashKardErrorHandler() );

<snap>

After fixing kvoc flashkard read all my files :-)

cheers
Ewald

-- 
Ewald Arnold, Germany
http://www.ewald-arnold.de/
mailto:ewald at ewald-arnold.de
mobil/sms:+49-162-8001240

_______________________________________________
kde-edu-devel mailing list
kde-edu-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-edu-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic