This week's giveaway is in the Programmer Certification (OCPJP) forum.
We're giving away four copies of Java Mock Exams (software) and have David Mayer on-line!
See this thread for details.
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

NMTOKEN

 
Andles Jurgen
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whats the deal with the NMTOKEN attribute type?
Is this simply a way of ensuring that a string in an attribute is just a single word (token) and not a sentance of words?? This is the only way I can see any use for it.
( I am thinking StringTokenizer from Java )
Just want to clear this up - thanks in advance.
Andles
 
Andles Jurgen
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don,t all respond at once!!
 
Scott Duffy
Author
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Andles Jurgen:
Whats the deal with the NMTOKEN attribute type?
Is this simply a way of ensuring that a string in an attribute is just a single word (token) and not a sentance of words?? This is the only way I can see any use for it.

Not only does it have to be a single word, but it has to be a valid XML name.
( Letter | Digit | '.' | '-' | '_' | ':' )
So one way it can be used is to specify an element name as an attribute value, for instance.
<search-request tag="blockquote">To be or not to be</search-request>
Best regards,
Scott
 
Andles Jurgen
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks - I kind of thought thats what it was for - just seemed too simple. Though I am kind of getting the big picture now and understanding the idea behind it.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!