File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Product and Other Certifications and the fly likes what is NMTOKEN Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Product and Other Certifications
Reply Bookmark "what is NMTOKEN" Watch "what is NMTOKEN" New topic
Author

what is NMTOKEN

Rahul Mahindrakar
Ranch Hand

Joined: Jul 28, 2000
Posts: 1831
Hi,
I would like to know what is NMTOKEN as given by the XML 1.0 specification.
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
as given by the XML 1.0 specification NMTOKEN is
[7] Nmtoken ::= (NameChar)+
Where NameChar is defined as
NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender
"letter, " "digit" et al are references to corresponding Unicode definitions, I suppose. So basically "NMTOKEN" consists of letters, digits, and . - _ : characters.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
NMTOKEN's are used to describe attribute type declarations.
I quote Norman Walsh from his article "A Technical Introduction to XML ":
"Name token attributes are a restricted form of string attribute. In general, an NMTOKEN attribute must consist of a single word [Section 1.5, production 7], but there are no additional constraints on the word, it doesn't have to match another attribute or declaration."
Vinayak
Karthik Guru
Ranch Hand

Joined: Mar 06, 2001
Posts: 1209
as indicated , you w'd want to consider NMTOKEN as against PCDATA when you are sure that the attribute value needs to be a single word and not many words.
<person age="10"/>
if age is declared as type CDATA, it can take any value. But when declared as NMTOKEN you can atleast be sure that it can't be "hello world". But it can be "hello" for sure.
But then if you are lookign for strong data typing, you w'd probably go for schemas.
Am not aware of any other advantages of NMTOKEN
Others can probably comment on that.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what is NMTOKEN
 
Similar Threads
Entity Bean naming
CDATA type
NMTOKEN vs ID
NMTOKEN/NMTOKENS
NMTOKENS ...