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 IDREFDV 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 return content; 44 } 45 46 public void checkExtraRules(Object value, ValidationContext context) throws InvalidDatatypeValueException { 47 context.addIdRef((String )value); 48 } 49 50 } 52 | Popular Tags |