Using ODF Relax NG schema to generate easier XML writing classes

Sebastian Sauer mail at dipe.org
Sat Jun 11 03:57:19 BST 2011


Thorsten Zachmann wrote:
> Hello,
> 
> On Friday, June 10, 2011 08:22:04 Jos van den Oever wrote:
>> Here is an idea to improve code quality in Calligra.
>> 
>> Currently, we use KoXmlWriter to write ODF XML. For this, functions like
>> startElement, endElement, addAttribute are used.
>> 
>> By using the Relax NG schema, we could generate a wrapper around this
>> class which would give us functions like
>> 
>>  TextPWriter TextContentWriter::startTextP();
>>  void TextHWriter::writeTextOutlineLevel(quint32 level);
> 
> I don't really like this approach. We will end up with quite a lot of
> classes which all have very different methods. And my IDE (vi) will not
> help me with that. Also the classes can get very big for some tags as a
> lot of attributes are allowed. And it will make it not possible to add
> custom attributes as used in some cases.

+1

> I would much more prefer that we increase our automated testing to find
> this problems. That should be fairly easy to do. Also if integrated into
> the stuff Cyrille is doing it should work quite nicely to not allow moving
> to master- verified when e.g. invalid odf is produced. We need a way to
> define the additional tags that we want to use.

+1

Also this seems to be a very regression friendly approach. I don't think 
throwing away what we have is a good idea nor that doing the job 
(loading+saving) in 2 completly different ways is good.



More information about the calligra-devel mailing list