This week's book giveaway is in the Android forum.
We're giving away four copies of Android Programming: The Big Nerd Ranch Guide and have Bill Phillips & Chris Stewart on-line!
See this thread for details.
Win a copy of Android Programming: The Big Nerd Ranch Guide this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

NMTOKEN  RSS feed

 
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!