XML serialization functionality
frans.englich at telia.com
Mon Mar 20 11:49:38 GMT 2006
On Monday 20 March 2006 09:39, Thiago Macieira wrote:
> David Faure wrote:
> >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.
> We're talking about tag indenting, I hope.
> Text should never be indented. It should be preserved as-is, including
> line-breaks and spacing characters.
> And attributes go inside tags, so they don't get indented either.
In short: indentation is purely subjective, and a mess. I don't see any kind
of indentation(except attributes..) which doesn't change the data of the
document. However, in some cases this doesn't matter because the particular
format specifies that certain elements should be whitespace normalized. It's
just as much a no-no to indent text as it is to indent tags(as it is a go-go
for them both). It all depends on the format.
How about that XMLIndenter has the following characteristics:
* getter/setter "QString indentString() const;" The string can contain any
number of spaces or tabs. By default, it contains four spaces.
* A list, by default empty, of element names that must not be indented. When
XMLIndenter encounters a tag in the list, it does not indent content of it,
although it will with the content of child elements of the tag.
Wouldn't that make XMLIndenter work for many cases? For example, would
XMLIndenter/XMLWorker work out of the box for KOffice?
More information about the kde-core-devel