001 package com.thaiopensource.datatype.xsd; 002 003 import com.thaiopensource.xml.util.Naming; 004 005 class NmtokenDatatype extends TokenDatatype { 006 public boolean lexicallyAllows(String str) { 007 return Naming.isNmtoken(str); 008 } 009 public int getLength(Object obj) { 010 // Surrogates are not possible in an NMTOKEN. 011 return ((String)obj).length(); 012 } 013 public boolean alwaysValid() { 014 return false; 015 } 016 }