24 25 import javax.xml.validation.Schema; 26 import javax.xml.validation.Validator; 27 import javax.xml.validation.ValidatorHandler; 28 29 /** 30 * <p>Abstract implementation of Schema for W3C XML Schemas.</p> 31 * 32 * @author Michael Glavassevich, IBM 33 * @version $Id: AbstractXMLSchema.java,v 1.6 2010-11-01 04:40:07 joehw Exp $ 34 */ 35 abstract class AbstractXMLSchema extends Schema implements 36 XSGrammarPoolContainer { 37 38 /** 39 * Map containing the initial values of features for 40 * validators created using this grammar pool container. 41 */ 42 private final HashMap fFeatures; 43 44 public AbstractXMLSchema() { 45 fFeatures = new HashMap(); 46 } 47 48 /* 49 * Schema methods 50 */ 51 52 /* 53 * @see javax.xml.validation.Schema#newValidator() 54 */ 55 public final Validator newValidator() { 56 return new ValidatorImpl(this); 57 } 58 59 /* 60 * @see javax.xml.validation.Schema#newValidatorHandler() 61 */ 62 public final ValidatorHandler newValidatorHandler() { 63 return new ValidatorHandlerImpl(this); 64 } 65 66 /* 67 * XSGrammarPoolContainer methods 68 */ 69 70 /** 71 * Returns the initial value of a feature for validators created 72 * using this grammar pool container or null if the validators 73 * should use the default value. 74 */ 75 public final Boolean getFeature(String featureId) { 76 return (Boolean) fFeatures.get(featureId); 77 } 78 79 /* 80 * Other methods 81 */ 82 83 final void setFeature(String featureId, boolean state) { 84 fFeatures.put(featureId, state ? Boolean.TRUE : Boolean.FALSE); 85 } 86 87 } // AbstractXMLSchema | 24 25 import javax.xml.validation.Schema; 26 import javax.xml.validation.Validator; 27 import javax.xml.validation.ValidatorHandler; 28 29 /** 30 * <p>Abstract implementation of Schema for W3C XML Schemas.</p> 31 * 32 * @author Michael Glavassevich, IBM 33 * @version $Id: AbstractXMLSchema.java,v 1.6 2010-11-01 04:40:07 joehw Exp $ 34 */ 35 abstract class AbstractXMLSchema extends Schema implements 36 XSGrammarPoolContainer { 37 38 /** 39 * Map containing the initial values of features for 40 * validators created using this grammar pool container. 41 */ 42 private final HashMap fFeatures; 43 44 /** 45 * Map containing the initial values of properties for 46 * validators created using this grammar pool container. 47 */ 48 private final HashMap fProperties; 49 50 public AbstractXMLSchema() { 51 fFeatures = new HashMap(); 52 fProperties = new HashMap(); 53 } 54 55 /* 56 * Schema methods 57 */ 58 59 /* 60 * @see javax.xml.validation.Schema#newValidator() 61 */ 62 public final Validator newValidator() { 63 return new ValidatorImpl(this); 64 } 65 66 /* 67 * @see javax.xml.validation.Schema#newValidatorHandler() 68 */ 69 public final ValidatorHandler newValidatorHandler() { 70 return new ValidatorHandlerImpl(this); 71 } 72 73 /* 74 * XSGrammarPoolContainer methods 75 */ 76 77 /** 78 * Returns the initial value of a feature for validators created 79 * using this grammar pool container or null if the validators 80 * should use the default value. 81 */ 82 public final Boolean getFeature(String featureId) { 83 return (Boolean) fFeatures.get(featureId); 84 } 85 86 /* 87 * Set a feature on the schema 88 */ 89 public final void setFeature(String featureId, boolean state) { 90 fFeatures.put(featureId, state ? Boolean.TRUE : Boolean.FALSE); 91 } 92 93 /** 94 * Returns the initial value of a property for validators created 95 * using this grammar pool container or null if the validators 96 * should use the default value. 97 */ 98 public final Object getProperty(String propertyId) { 99 return fProperties.get(propertyId); 100 } 101 102 /* 103 * Set a property on the schema 104 */ 105 public final void setProperty(String propertyId, Object state) { 106 fProperties.put(propertyId, state); 107 } 108 109 } // AbstractXMLSchema |