XML serialization functionality

Frans Englich frans.englich at telia.com
Tue Mar 14 23:04:36 GMT 2006


On Monday 13 March 2006 21:39, David Faure wrote:
> On Sunday 12 March 2006 19:02, Frans Englich wrote:
> > I find that a fairly common thing to do, to produce XML.
>
> koffice/lib/store/KoXmlWriter.* does that for koffice. Writing out XML
> directly into a file (or any other QIODevice), to avoid the QDom memory
> problem (constructing the complete tree in memory before saving it).

I looked at the code, and to me SAXSerializer and KoXmlWriter are very 
similar.

> But this isn't related to QXmlDefaultHandler at all so I'm not sure this
> is related to your mail; only advertising another "xml generation" solution

I think it is relevant. SAXSerializer and KoXmlWriter operates in the same way 
and their APIs are quite similar. The advantage I see with sub-classing 
QXmlContentHandler(it should be that one instead of QXmlDefaultHandler, on my 
TODO) is that the class can act as a lego-brick. The serializer class can be 
plugged directly into arbitrary code that uses SAX, and one can pipe SAX 
streams by chaining several content handlers.

> (used widely in koffice and with unit-tests), so that if other apps have
> this need we can consider inclusion in kdelibs, it's a rather small class.

I will probably think/code on this and post. I really think we should lobby 
for Qt inclusion since it belongs on that level(IMHO), but more on that later 
on.


Cheers,

		Frans




More information about the kde-core-devel mailing list