1 16 17 package org.apache.xerces.impl.dv.xs; 18 19 import org.apache.xerces.impl.dv.InvalidDatatypeValueException; 20 import org.apache.xerces.impl.dv.ValidationContext; 21 import org.apache.xerces.util.XMLChar; 22 23 33 public class EntityDV extends TypeValidator { 34 35 public short getAllowedFacets(){ 36 return (XSSimpleTypeDecl.FACET_LENGTH | XSSimpleTypeDecl.FACET_MINLENGTH | XSSimpleTypeDecl.FACET_MAXLENGTH | XSSimpleTypeDecl.FACET_PATTERN | XSSimpleTypeDecl.FACET_ENUMERATION | XSSimpleTypeDecl.FACET_WHITESPACE ); 37 } 38 39 public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException { 40 if (!XMLChar.isValidNCName(content)) { 41 throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object []{content, "NCName"}); 42 } 43 44 return content; 45 } 46 47 public void checkExtraRules(Object value, ValidationContext context) throws InvalidDatatypeValueException { 48 if (!context.isEntityUnparsed((String )value)) { 49 throw new InvalidDatatypeValueException("UndeclaredEntity", new Object []{value}); 50 } 51 } 52 53 } | Popular Tags |