Using ODF Relax NG schema to generate easier XML writing classes
Thorsten Zachmann
t.zachmann at zagge.de
Sat Jun 11 06:56:18 BST 2011
On Friday, June 10, 2011 17:06:15 Jos van den Oever wrote:
> On Friday, June 10, 2011 08:22:04 AM Jos van den Oever wrote:
> > Here is an idea to improve code quality in Calligra.
>
> Here is a version that works fine with a small example use:
>
> #include "odf.h"
> #include <QtCore/QBuffer>
> #include <QtCore/QFile>
>
> int
> main() {
> QFile out;
> out.open(stdout, QIODevice::WriteOnly);
> KoXmlWriter xml(&out);
> {
> OfficeDocumentWriter doc(&xml);
> OfficeBodyWriter content(doc);
> OfficeTextWriter text(content);
> {
> TextHWriter h(text);
> h.addTextNode("Hello ODF!");
> }
> {
> TextPWriter p(text);
> p.addTextNode("This is paragraph 1.");
> }
> }
> out.close();
> return 0;
> }
That code looks a bit ugly but I have no idea on how to improve that.
Also one thing to notice is that this will increase compilation time quite a
but I would guess.
Thorsten
More information about the calligra-devel
mailing list