Attribute type NMTOKEN
John E. Simpson
simpson at polaris.net
Sat May 9 16:26:03 BST 1998
At 09:50 AM 5/8/98 -0400, in a stuporous moment I wrote:
>a type of NMTOKEN would not allow a value such as
>"1ABC," "//ENGLISH," or " WHITESPACE."
At 04:25 PM 5/8/98 -0400, Chris Maden clarified:
>A possible misunderstanding here: a NMTOKEN itself can't contain
>whitespace, but the attribute value specification, the quoted thing
>after the equals sign, can: so
><my-element my-name-token=" WHITESPACE">
>*is* a valid NMTOKEN attribute specification. The NMTOKEN in this
>example is only "WHITESPACE", though; the leading (and trailing)
>whitespace is trimmed.
Then at 03:31 PM 5/8/98 -0600, Russ Heithoff further clarified:
>Also, if I remember right, a NMTOKEN can start with Name characters. This
>is in contrast to a Name which must start with Name Start characters
>followed by characters. In otherwords 1ABC is a legal NMTOKEN but not a
Sheesh -- 2 flubs out of 3 swings at it!
So to summarize:
(1) The purpose of the NMTOKEN attribute type is to constrain the content
of attribute values by their *form* (rather than by their actual value, as
would be done with an enumeration). (I think this general statement was
true even though I muffed the examples!)
(2) The *form* of an attribute value declared as type NMTOKEN is such that
it may contain only valid NAME characters. The valid name characters are
"letters" (alphabetics as expressed in ASCII Latin, ISO Latin, and so on);
digits (also including ASCII and various international sets); limited
punctuation (full stop (.), hyphen (-), colon (:)); and various combining
and extending characters required for internationalization. Internal
whitespace is not allowed in NMTOKEN-type attribute values. [Constraints in
item (2) established by productions #4, 7, and 84-89 in REC-xml-19900210.]
(3) Leading and trailing whitespace is trimmed/ignored before determining
whether the value is valid for a NMTOKEN-type attribute.
Thanks to Chris (again) and Russ for correcting my examples.
Best regards, | It's no disgrace t'be poor,
John E. Simpson | but it might as well be.
simpson at polaris.net | -- "Kin" Hubbard
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;
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
More information about the Xml-dev