[
Lists Home |
Date Index |
Thread Index
]
Alessandro Triglia scripsit:
> > From: mgushee@havenrock.com [mailto:mgushee@havenrock.com]
> > * White space in elements can be preserved, whereas white space in
> > attributes is normalized (leading and trailing spaces are stripped,
> > each extent of internal white space is collapsed to a single space
> > character).
>
> I don't follow you. If the schema is specified in XML Schema and the
> datatype of an attribute is "string" (whose "whitespace" facet is
> "preserve" by default), I don't believe white space is normalized.
Whitespace normalization depends on the DTD, if any. If an attribute
is declared in the DTD as of type CDATA, or is not defined in the DTD, or
the parser does not read the relevant part of the DTD, then minimal
normalization of its value is done: namely, tabs, newlines, and CRs are
changed to spaces. A CR can only exist in an attribute value by the
use of Stupid DTD Tricks.
If the attribute is declared in the DTD with a type other than CDATA, and the
parser knows it, then further normalization is done: leading and trailing
spaces are removed, and all other runs of spaces are collapsed to a single
space.
All this is done conceptually *before* any XML Schema processing is done.
Nothing analogous is done to character content, So:
> an attribute of type "string" behaves differently from
> an element of type "string" as to white space handling?
Yes.
--
Knowledge studies others / Wisdom is self-known; John Cowan
Muscle masters brothers / Self-mastery is bone; jcowan@reutershealth.com
Content need never borrow / Ambition wanders blind; www.ccil.org/~cowan
Vitality cleaves to the marrow / Leaving death behind. --Tao 33 (Bynner)
|