[PATCH] XML validity of kcfg files

Frans Englich frans.englich at telia.com
Sat Oct 30 20:20:01 BST 2004


On Saturday 30 October 2004 18:59, Ingo Klöcker wrote:
<SNIP>
> > > > The reordering could be mandated by the DTD.
> > >
> > > yes, but it isn't.
> >
> > Sorry, but it is:
> >
> > For example, take this line from the DTD:
> >
> >  <!ELEMENT entry
> > (parameter?,label?,whatsthis?,choices?,code?,default*,min?,max?)>
> >
> > That means that the subelements must appear in exactly that order
> > (if they are present, "?" and "*" allow elements to appear "zero
> > times").
>
> Is there a valid reason for making this order mandatory, i.e. does
> changing the order change the semantics? If not, then the DTD is IMO
> too strict.

I agree. Often, DTDs enforce a certain order, but I don't understand why. If 
one wants output in a certain order in an XSLT tranformation, that can be 
achieved by doing specific apply-templates calls. Also, I can't see how it 
can matter in DOM traversing, unless it's really hard coded. I find element 
ordering hard to remember, and just adds a lot of annoying syntax/nit-picking 
writing.

If I were to fix the kcfg DTD by skipping the sequence restrictions(if it's 
certain it won't break), I would rewrite it in XML Schema, since it's a lot 
easier language :), can embed documentation, and it would also allow more 
exact validation. One could generate documentation from it with x3sp[1], as 
accompaniment to the KConfigXT HOWTO[2].


Some ideas,

			Frans

1.
http://titanium.dstc.edu.au/xml/xs3p/

2.
http://developer.kde.org/documentation/tutorials/kconfigxt/kconfigxt.html




More information about the kde-core-devel mailing list