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 import com.sun.org.apache.xerces.internal.util.XMLChar; 63 64 72 public class EntityDV extends TypeValidator { 73 74 public short getAllowedFacets(){ 75 return (XSSimpleTypeDecl.FACET_LENGTH | XSSimpleTypeDecl.FACET_MINLENGTH | XSSimpleTypeDecl.FACET_MAXLENGTH | XSSimpleTypeDecl.FACET_PATTERN | XSSimpleTypeDecl.FACET_ENUMERATION | XSSimpleTypeDecl.FACET_WHITESPACE ); 76 } 77 78 public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException { 79 if (!XMLChar.isValidNCName(content)) { 80 throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object []{content, "NCName"}); 81 } 82 83 return content; 84 } 85 86 public void checkExtraRules(Object value, ValidationContext context) throws InvalidDatatypeValueException { 87 if (!context.isEntityUnparsed((String )value)) { 88 throw new InvalidDatatypeValueException("UndeclaredEntity", new Object []{value}); 89 } 90 } 91 92 } | Popular Tags |