XML serialization functionality

David Faure faure at kde.org
Mon Mar 20 09:32:20 GMT 2006


On Monday 20 March 2006 10:16, Thiago Macieira wrote:
> Frans Englich wrote:
> >My idea is to create an "XMLIndenter" class(which KOffice seems to need)
> >depending on feedback. XMLIndenter would sub-class QXmlContentHandler,
> > have a content handler("QXmlContentHandler *contentHandler() const",
> > etc) and a property for the indentation string("void
> > setIndentString(const QString &i)", etc). It would re-implement all the
> > handler functions and before/after sending forwarding to its
> > contentHandler(), it would push indentation via characters().
> 
> Huh? Indentation?
> 
> Unless you consider the \n too much, I recommend adding them after each 
> and every tag. Then you add level * n spaces, where level is your nesting 
> level and "n" is a user-defined value of the number of spaces per level. 
> No indentation would mean n = 0.
> 
> That's how QDomNode::save works.

Yep, but it's not enough for OASIS-compliant saving.
It can use indentation everywhere -except- inside <text:p> tags, where space matters.
So some reimplementable behavior is needed (but I agree that a string might be overkill,
from a API point of view an int is enough, as long as it can be turned off completely for
a given tag).
Not that I'm really motivated to port KOffice's saving code yet another time, so
this is a rather academic discussion to me.

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).





More information about the kde-core-devel mailing list