my dog learned polymorphism*
The moose likes Product and Other Certifications and the fly likes NMTOKEN Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Product and Other Certifications
Bookmark "NMTOKEN" Watch "NMTOKEN" New topic
Author

NMTOKEN

Andles Jurgen
Ranch Hand

Joined: Mar 18, 2002
Posts: 67
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

Joined: Mar 18, 2002
Posts: 67
Don,t all respond at once!!
Scott Duffy
Author
Ranch Hand

Joined: May 23, 2002
Posts: 58
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


Scott Duffy<br />:: MCSD, SCJP, IBMXML<br />:: Author of <a href="http://www.xguru.com/tutorial/cat_index.asp?cat=5" target="_blank" rel="nofollow">IBM XML Certification Guide</a><br />:: Author of <a href="http://www.amazon.com/exec/obidos/tg/detail/-/0072228873" target="_blank" rel="nofollow">How to Do Everything in JavaScript</a>, Osborne Press
Andles Jurgen
Ranch Hand

Joined: Mar 18, 2002
Posts: 67
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.
 
subject: NMTOKEN
 
Similar Threads
CDATA type
what is NMTOKEN
NMTOKEN vs ID
Question on Java to WSDL mapping
NMTOKEN/NMTOKENS