1 57 58 package com.sun.org.apache.xerces.internal.impl.dv.xs; 59 60 import com.sun.org.apache.xerces.internal.impl.dv.InvalidDatatypeValueException; 61 import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext; 62 63 71 public class BooleanDV extends TypeValidator{ 72 73 private static final String fValueSpace[] = {"false", "true", "0", "1"}; 74 75 public short getAllowedFacets(){ 76 return (XSSimpleTypeDecl.FACET_PATTERN | XSSimpleTypeDecl.FACET_WHITESPACE); 77 } 78 79 public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException { 80 Boolean ret = null; 81 82 if (content.equals(fValueSpace[0]) || content.equals(fValueSpace[2])) 83 ret = Boolean.FALSE; 84 else if (content.equals(fValueSpace[1]) || content.equals(fValueSpace[3])) 85 ret = Boolean.TRUE; 86 else 87 throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object []{content, "boolean"}); 88 return ret; 89 } 90 91 } | Popular Tags |