Using ODF Relax NG schema to generate easier XML writing classes
Thorsten Zachmann
t.zachmann at zagge.de
Fri Jun 10 07:42:46 BST 2011
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.
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.
Thorsten
More information about the calligra-devel
mailing list