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