W3C home > Mailing lists > Public > xmlschema-dev@w3.org > July 2003

Re: Is " ID_234" a valid content for attribute of type xsd:ID?

From: Jeni Tennison <jeni@jenitennison.com>
Date: Tue, 29 Jul 2003 11:18:29 +0100
Message-ID: <701900552349.20030729111829@jenitennison.com>
To: "Noga Atsil" <Noga.Atsil@smarteam.com>
CC: xmlschema-dev@w3.org

Hi Noga,

> According to the spec ( http://www.w3.org/TR/xmlschema-2/#ID) ID
> value should be a valid NCName (
> http://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-NCName)
> Does it include values that start with space, such as "   ID_234"?

It doesn't include *values* that start with a space, but in an XML
element or attribute of that type, you can include spaces. For
example, the following id attribute holds a legal ID value:

  <foo id="    ID_234" />

The string value in an XML document goes through whitespace
normalization before its assessed to see if it's a valid value. For ID
values, whitespace normalization involves stripping away all the
leading and trailing whitespace (and substituting any internal runs of
whitespace with a single space, though if you have any internal runs
of whitespace then you can't have a legal value).

So the string value of the id attribute ("   ID_234") gets whitespace
normalized to "ID_234", which is a legal NCName. Note that this means
that the following are equivalent as far as an XML Schema processor is

  <foo id="ID_234" />
  <foo id="   ID_234" />
  <foo id="   ID_234   " />



Jeni Tennison
Received on Tuesday, 29 July 2003 06:18:41 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:02 UTC