~ubuntu-branches/debian/wheezy/jing-trang/wheezy

« back to all changes in this revision

Viewing changes to mod/xsd-datatype/src/main/com/thaiopensource/datatype/xsd/NmtokenDatatype.java

  • Committer: Bazaar Package Importer
  • Author(s): Samuel Thibault
  • Date: 2009-09-01 15:53:03 UTC
  • Revision ID: james.westby@ubuntu.com-20090901155303-2kweef05h5v9j3ni
Tags: upstream-20090818
ImportĀ upstreamĀ versionĀ 20090818

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package com.thaiopensource.datatype.xsd;
 
2
 
 
3
import com.thaiopensource.xml.util.Naming;
 
4
 
 
5
class NmtokenDatatype extends TokenDatatype {
 
6
  public boolean lexicallyAllows(String str) {
 
7
    return Naming.isNmtoken(str);
 
8
  }
 
9
  public int getLength(Object obj) {
 
10
    // Surrogates are not possible in an NMTOKEN.
 
11
    return ((String)obj).length();
 
12
  }
 
13
  public boolean alwaysValid() {
 
14
    return false;
 
15
  }
 
16
 
 
17
  String getLexicalSpaceKey() {
 
18
    return "nmtoken";
 
19
  }
 
20
}