Subject: Re: Posted PaceTextRules

From: Martin Duerst <[email-masked]>
Date: Tue, 01 Feb 2005 18:08:50 +0900

At 17:09 05/01/31, Henri Sivonen wrote:
 >
 >On Jan 31, 2005, at 03:00, Graham wrote:
 >
 >> "Software displaying this text SHOULD remove white-space at the 
beginning and end; collapse white-space between words; and disregard line 
break, tab and other formatting characters." in 3.1.1 (TEXT).
 >
 >+1 with the minor nit that lone line breaks should be considered 
spaces--not disregarded. Thus: Software displaying this text SHOULD remove 
white-space at the beginning and end; and treat sequences of one or more 
XML white-space characters as a single space.

Except that that's completely inadequate for some Asian languages
(Chinese, Japanese, Thai,...). Point to a spec developed
by experts if you need to rather than trying to reinvent the wheel.

Regards,    Martin.

---

From: Martin Duerst <[email-masked]>
Date: Tue, 01 Feb 2005 18:09:49 +0900

At 00:38 05/02/01, Tim Bray wrote:
 >
 >
 >On Jan 31, 2005, at 5:37 AM, Bjoern Hoehrmann wrote:

 >> http://www.w3.org/MarkUp/2004/xhtml-faq#xmlspace cites a quite different
 >> opinion on this matter...
 >
 >Yes, well that opinion is (a) specific to HTML and (b) wrong.  I'm amazed 
that the W3C allowed that to be published.  -Tim

Would you mind explaining why you think it's wrong?

Regards,    Martin.

---

From: Bjoern Hoehrmann <[email-masked]>
Date: Tue, 01 Feb 2005 14:03:41 +0100

>Would you mind explaining why you think it's wrong?

Such white-space is considered character data in XML 1.0 and DOM Level 3
defines

  The Text interface inherits from CharacterData and represents the
  textual content (termed character data in XML) of an Element or Attr.
  If there is no markup inside an element's content, the text is
  contained in a single object implementing the Text interface that is
  the only child of the element. If there is markup, it is parsed into
  the information items (elements, comments, etc.) and Text nodes that
  form the list of children of the element.

which refers to the XML Infoset which requires that such white-space is
exposed. There is thus no reasonable ground to claim that xml:space has
any impact whatsoever on the document object model; the FAQ claims the
exact opposite, in particular, without ever saying what white-space
would be in the DOM for e.g.

  <p xml:space = 'default'>x  y</p>

It could be "x y" or "xy" or for

  <p xml:space = 'default'>x&#xa;y</p>

it could be "xy", or "x y", etc. Following the cited rationale in the
FAQ, all XML formats that do not define xml:space='preserve' for all
elements would have essentially random white-space processing behavior,
which is fortunately not the case. Please refer to

  http://hades.mn.aptest.com/cgi-bin/voyager-issues/Modularization-DTDs?id=6300#followup2

for further details.
-- 
Björn Höhrmann · mailto:[email-masked] · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/

---

From: Tim Bray <[email-masked]>
Date: Tue, 01 Feb 2005 07:42:03 -0800

On Feb 1, 2005, at 1:09 AM, Martin Duerst wrote:

> >Yes, well that opinion is (a) specific to HTML and (b) wrong.  I'm 
> amazed that the W3C allowed that to be published.  -Tim
>

It says

"The attribute xml:space is about input: that is to say, it controls if 
the spaces will be present in the DOM (i.e. in the internal version of 
the document inside the browser); it says nothing about what will 
appear on your screen."

Which is wrong.  xml:space is not about input whatsoever, it's a 
message from the provider of the document to any software downstream 
that cares to listen, with no normative effect.  It suggests that 
elements which do not have "xml:space='preserve'", the DOM will 
necessarily remove white-space.  I didn't think the DOM said that, and 
I just went and checked the DOM levels 1, 2, and 3 specs, and didn't 
find any instances of "xml:space". The DOM spec is big and complicated, 
maybe I missed it.  But on the face of it, it seems that the text is 
wrong. -Tim

---

From: Henri Sivonen <[email-masked]>
Date: Tue, 1 Feb 2005 17:41:34 +0200

On Feb 1, 2005, at 11:08, Martin Duerst wrote:

>> spaces--not disregarded. Thus: Software displaying this text SHOULD 
>> remove white-space at the beginning and end; and treat sequences of 
>> one or more XML white-space characters as a single space.
>

I used http://www.w3.org/TR/2004/REC-xml-20040204/#AVNormalize and the 
default white-space behavior of browsers as the precedent.

Could you please point to a spec that is developed by experts and does 
not reinvent the wheel? Also, I would appreciate a pointer to a 
document explaining the issues with Chinese, Japanese and Thai. I don't 
think what I wrote above in any way precludes soft line breaks for 
display at places that do not have adjacent XML white-space.

(All this would be so much easier if XML used linefeeds and tabs for 
pretty-printing and those could always be dropped and spaces were 
always meaningful content. Too late to change it though.)

-- 
Henri Sivonen
[email-masked]
http://iki.fi/hsivonen/