KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thaiopensource > datatype > xsd > BooleanDatatype


1 package com.thaiopensource.datatype.xsd;
2
3 import org.relaxng.datatype.ValidationContext;
4
5 class BooleanDatatype extends DatatypeBase {
6   boolean lexicallyAllows(String JavaDoc str) {
7     return str.equals("true") || str.equals("false") || str.equals("1") || str.equals("0");
8   }
9   Object JavaDoc getValue(String JavaDoc str, ValidationContext vc) {
10     switch (str.charAt(0)) {
11     case 't':
12     case '1':
13       return Boolean.TRUE;
14     }
15     return Boolean.FALSE;
16   }
17 }
18
Popular Tags