1 22 23 package org.xquark.schema.datatypes; 24 25 import java.util.HashMap ; 26 import java.util.HashSet ; 27 import java.util.Iterator ; 28 29 import org.xquark.schema.SchemaException; 30 import org.xquark.schema.validation.ValidationContextProvider; 31 32 33 class NOTATIONType extends AbstractQNameType { 34 private static final String RCSRevision = "$Revision: 1.1 $"; 35 private static final String RCSName = "$Name: $"; 36 37 NOTATIONType() { 38 super("NOTATION", PrimitiveType.NOTATION); 39 } 40 41 protected void setEnumeration(HashSet value, ValidationContextProvider vcProvider) throws SchemaException { 42 Iterator it = value.iterator(); 43 HashMap notations = (HashMap ) vcProvider.getNotationDeclarations(); 44 while (it.hasNext()) { 45 String facetValue = (String ) it.next(); 46 if (!notations.containsKey(facetValue)) { 47 throw new SchemaException("unknown-error-code.3"); 49 } 50 } 51 super.setEnumeration(value, vcProvider); 52 } 53 54 public void checkFacets(Object valueSpace) throws SchemaException { 55 if (super.getEnumerations() == null) { 56 super.invalidFacet("enumeration-required-notation", valueSpace, "enumeration"); 58 } 59 super.checkFacets(valueSpace); 60 } 61 protected QName createQName(String namespaceURI, String localName) { 62 return new Value(namespaceURI, localName); 63 } 64 65 class Value extends QName { 66 67 public Value(String namespaceURI, String localName) { 68 super(namespaceURI, localName); 69 } 70 71 protected boolean checkClass(Object obj) { 72 return obj instanceof Value; 73 } 74 } 75 76 } 77 | Popular Tags |