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.util.XMLChar; 62 import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext; 63 64 72 public class IDDV 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 return content; 83 } 84 85 public void checkExtraRules(Object value, ValidationContext context) throws InvalidDatatypeValueException { 86 String content = (String )value; 87 if (context.isIdDeclared(content)) 88 throw new InvalidDatatypeValueException("cvc-id.2", new Object []{content}); 89 context.addId(content); 90 } 91 } | Popular Tags |