Whitespace

John Cowan cowan at locke.ccil.org
Thu Aug 6 21:55:28 BST 1998


Peter Jones scripsit:

> P.S. I have read the XML 1 spec concerning whitespace, but this seems to
> contain a logical contradiction. Viz:

Let's try to sort out the confusion with a few well-chosen verbs.

> "An XML processor must always pass all characters in a document that are
> not markup through to the application.

That means that XML processors can't ever *discard* whitespace
unless it's within markup.

> A validating XML processor must
> also inform the application which of these characters constitute
> whitespace appearing in element content.

That means that validating processors, but not necessarily other
processors, must *flag* whitespace that is present in elements
whose content model allows only other elements, not PCDATA as well.

Non-validating processors are allowed to ignore this requirement
because they don't necessarily know what the content model of
an element is.

The wise application, therefore, will not count on the presence of
this flagging unless it knows that a validating parser is in use.

> xml:space...attached to an element to signal an intention that in that
> element, white space should be preserved by applications. In valid
> documents, this attribute, like any other must be declared if it is
> used...

The "xml:space='preserve'" attribute value *signals* the document
author's intention to make whitespace as significant to a processing
application as any other character data.  This intention should be
implemented by the application through checking the value of this
attribute: the parser has nothing to do with it.

> The value "default" signals that applications' default white space
> processing modes are acceptable for this element..."

The "xml:space='default'" attribute value, on the other hand, signals
that processing applications should follow their own rules about
ignoring, selectively ignoring, or respecting whitespace, whatever
those might be.  Again, the parser has nothing to do with it.

-- 
John Cowan	http://www.ccil.org/~cowan		cowan at ccil.org
	You tollerday donsk?  N.  You tolkatiff scowegian?  Nn.
	You spigotty anglease?  Nnn.  You phonio saxo?  Nnnn.
		Clear all so!  'Tis a Jute.... (Finnegans Wake 16.5)

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)




More information about the Xml-dev mailing list