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

List:       koffice-devel
Subject:    Re: PATCH: kspread and kword DTD
From:       Thomas Zander <zander () planescape ! com>
Date:       2002-06-24 21:46:09
[Download RAW message or body]

On Mon, Jun 24, 2002 at 10:09:27PM +0200, Nicolas Goutte wrote:
> On Monday 24 June 2002 18:12, David Faure wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > On Monday 24 June 2002 17:28, Daniel Naber wrote:
> > > On Monday 24 June 2002 17:18, David Faure wrote:
> > > > Probably because most developers (me included) don't know how to
> > > > validate against a DTD (I think it's about xmllint, but I never tried
> > > > it myself). Feel free to report the errors you see.
> > >
> > > It works like this (kword.dtd and maindoc.xml both in the current
> > > directory - you also have to remove the http://... from the first line in
> > > the XML document, otherwise the online DTD will be used):
> > >
> > > xmllint -noout --dtdvalid kword.dtd maindoc.xml
> > >
> > > With an almost empty document I get:
> > >
> > > Element DOC content doesn't follow the DTD
> > > Expecting (PAPER , ATTRIBUTES , VARIABLESETTINGS , FOOTNOTESETTING ,
> > > ENDNOTESETTING , FRAMESETS , STYLES , PIXMAPS , CLIPARTS , SERIALL ,
> > > EMBEDDED* , SPELLCHECKIGNORELIST , BOOKMARKS), got (PAPER ATTRIBUTES
> > > VARIABLESETTINGS FOOTNOTESETTING ENDNOTESETTING FRAMESETS STYLES
> > > FRAMESTYLES TABLESTYLES PICTURES MAILMERGE )
> >
> > Ah, SERIALL was renamed to MAILMERGE in the code but not in the DTD.
> > But now we have two different MAILMERGE elements!
> >
> > mailmerge.cc:   QDomElement parentElem=doc.createElement("MAILMERGE");
> > koVariable.cc:    QDomElement elem =
> > parentElem.ownerDocument().createElement( "MAILMERGE" );
> >
> > This works well in practice, but makes it impossible to document using
> > a DTD. Anyone knows a way?
> 
> The only way that you have is to define both together as one elemnt and to 
> document the two versions in a comment. 
Agree.

> This also means that children and 
> attributes are all optionals, 

Well, you can do an 'or' statement;
<!ELEMENT MAILMERGE
    ((FIELD+),EMPTY) >

Don't know if I got the syntax correct, but I meant to say; at least one FIELD
child (for one usage), or an empty list (for the other usage).   This can be
simplyfied but I'm not sure what the end result should be, so just an example :)

You are right that the attributes are all optional, if not used by both.

-- 
Thomas Zander                                           zander@planescape.com
                                                 We are what we pretend to be

[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