If attribute type declared as NMTOKEN or ID what values can both of them accept. In other words what is the difference between NMTOKEN and ID. '12345-09' is a valid NMTOKEN but not valid ID. Because ID has to be XML name. Isn't this true with NMTOKEN ?
Note '12345-09' is not a valid XML name as the first character is a number (Name1 character restriction) ID type attributes must fully comply to XML Name restrictions whereas Nametokens comply to all ex cept the Name1 char restriction for XML Names.
Karthik Jayaraman.<br />IBM Certified Developer - XML and Related Technologies.<br />Sun Certified Developer for java WebServices.<br />Sun Certified Java Programmer.
posted 17 years ago
Karthik: I did not get you when u say "NMTOKEN comply to all" except Name1 char restriction. Does it mean that NMTOKEN has to be in XML name syntax except that the 1st character can be a number, dot, hyphen etc.
Dear Nitin, The syntax of XML1.0 is expressed in EBNF to avoid ambiguity and confusion. The production for Name and Nmtoken are the following:  NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender  Name ::= (Letter | '_' | ':') (NameChar)*  Nmtoken ::= (NameChar)+ The EBNF notation is quite easy to learn. If you are not familiar with EBNF, I highly recommend that you read Section 6 of the XML specification which contain an EBNF primer. Once you understand the EBNF notation, the grammar of XML1.0 becomes clear. Other specs like XPath are also expressed in EBNF. I always start my XML classes my explaining EBNF. My experience is that it works very well.