[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: Problems with User-defined variables in KWord
From:       Thomas Zander <zander () kde ! org>
Date:       2006-03-17 23:35:49
Message-ID: 200603181235.49440.zander () kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


On Friday 17 March 2006 16:29, Gary Cramblitt wrote:
> In general, whitespace handling is not well-defined in mixed content
> when the XML parser does not have a DTD or schema.   For instance, is
> the space in the following meaningful?
>
> <a> <b>sometext</b></a>
>
> If a DTD is present and the <a> tag is not allowed to have mixed
> content, then the parser knows the space between <a> and <b> is "not
> meaningful" and can ignore it (although it is still required to inform
> the application about it). But in the absence of a DTD or schema, the
> parser cannot know this.   In this case, according to _The XML
> Companion_, the whitespace is not defined and subject to "application
> interpretation".

This is not fully accurate; XML rules (see xml.com for reference material) 
state very clearly that all content in an XML DOM has to be preserved.
This includes the space above.

The trick is that you read your DOM tree by asking for the first element 
under the 'a' element which will give you the 'b' element.
If, however, you would have asked for the first _node_ (which is either 
element, text or comment) you would have gotten the space.

This seems to make correct XML almost impossible until you figure out that 
its rather easy to have text as a subnode without needing any indentation 
at all. Like this: <a>foo</a>

In effect; for anyone who knows his XML (and I know there are quite some 
on the ODF team that do) the xml that started this thread is interpreted 
correctly by KWord, and you should output the xml without a linefeed if 
it does not mean the linefeed to be there.
Its really that simple.  Don't output it if you don't mean it to be there.

-- 
Thomas Zander

[Attachment #5 (application/pgp-signature)]

_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic