[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice-devel
Subject: Re: [PATCH] XML file is not a KWord Document
From: Thomas Zander <zander () planescape ! com>
Date: 2001-12-04 22:14:09
[Download RAW message or body]
On Tue, Dec 04, 2001 at 09:55:45PM +0100, Nicolas Goutte wrote:
> On Monday 03 December 2001 09:27, Thomas Zander wrote:
> > On Sun, Dec 02, 2001 at 10:50:19PM +0100, Nicolas Goutte wrote:
> > > Attached is a patch for kword/kwdoc.cc
> > >
> > > The purpose of the patch is to verify that the loaded XML file is really
> > > starting with a <DOC> element. If not, then it is not a KWord file and an
> > > error message is given.
> > >
> > > Until now, this problem was catched by the wrong mime type check. However
> > > this patch gives better information to the user of what is wrong.
> > >
> > > It helps also some users to understand that even if KWord uses XML, it
> > > cannot load any (generic) XML file.
> >
> > just curious;
> >
> > a typical kword file starts with;
> > <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE DOC >
> > <DOC mime="application/x-kword" syntaxVersion="1" editor="KWord" >
> >
> > which DOC do you check for; and should you not also check for the mime in
> > this same piece of code? (That is the mime embedded in the file; not the
> > mime the OS thinks the file is)
>
> This patch adds a test for the document element ( <DOC ... > ) and not for
> the document type ( <!DOCTYPE DOC > ). The document type cannot be checked,
> as old KWord files does not have it.
>
> The mime attribute is checked just thereafter.
>
> I had just wanted a more descriptive error message when someone tries to read
> a non-KWord XML file. However, it could also be done at the check for an
> empty/missing mime attribute. I am still hesitating what would be the best.
>
> Last minute: I think that I will not apply the patch. The reason is that we
> do not really care about the name of the document element. However, if in a
> later version of KWord, we want to change the name of document element from
> the quite generic name of <DOC> to something more precise like <KWORD>, KWord
> 1.2 with my patch would not be able to read those files.
Ok, I personally think that checking just the mime will do it; remember that
in normal cases the xml will be included in an archive file.
In other cases (like with filters etc) the mime type will do the trick.
--
Thomas Zander zander@earthling.net
The only thing worse than failure is the fear of trying something new
[Attachment #3 (application/pgp-signature)]
_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic