/** * Set a feature of this XPath implementation. The only features currently * recognized are: * <ul> * <li> {@link XMLConstants#FEATURE_SECURE_PROCESSING} </li> * <li> {@link net.sf.saxon.FeatureKeys#SCHEMA_VALIDATION}: requests schema validation of source documents. * The property is rejected if the configuration is not schema-aware. </li> * </ul> * @param feature a URI identifying the feature * @param b true to set the feature on, false to set it off * @throws XPathFactoryConfigurationException if the feature name is not recognized */ public void setFeature(String feature, boolean b) throws XPathFactoryConfigurationException { if (feature.equals(FEATURE_SECURE_PROCESSING)) { config.setAllowExternalFunctions(!b); } else if (feature.equals(FeatureKeys.SCHEMA_VALIDATION)) { config.setSchemaValidationMode(b ? Validation.STRICT : Validation.STRIP); } else { throw new XPathFactoryConfigurationException("Unknown feature: " + feature); } }
private void initializeConfig() { logger.trace("initializeConfig.enter; current config: {}", config); config = Configuration.newConfiguration(); //config.setHostLanguage(Configuration.XQUERY); config.setSchemaValidationMode(Validation.STRIP); //config.setConfigurationProperty(FeatureKeys.ALLOW_EXTERNAL_FUNCTIONS, Boolean.TRUE); SaxonUtils.registerExtensions(config, null); if (libraries != null) { registerExtensions(config, libraries); } logger.trace("initializeConfig.exit; new config: {}", config); }
/** * Set a feature of this XPath implementation. The features currently * recognized are: * <ul> * <li> {@link XMLConstants#FEATURE_SECURE_PROCESSING} </li> * <li> {@link net.sf.saxon.lib.FeatureKeys#SCHEMA_VALIDATION}: requests schema validation of source documents. * The property is rejected if the configuration is not schema-aware. </li> * </ul> * <p>In addition, any Saxon configuration feature (listed in {@link FeatureKeys} can be used * provided the value is a boolean. (For non-boolean configuration properties, drop down to the underlying * Saxon {@link Configuration} object and call <code>setConfigurationProperty()</code>)</p> * * @param feature a URI identifying the feature * @param b true to set the feature on, false to set it off * @throws XPathFactoryConfigurationException * if the feature name is not recognized */ public void setFeature(String feature, boolean b) throws XPathFactoryConfigurationException { if (feature.equals(FEATURE_SECURE_PROCESSING)) { config.setBooleanProperty(Feature.ALLOW_EXTERNAL_FUNCTIONS, !b); } else if (feature.equals(FeatureKeys.SCHEMA_VALIDATION)) { config.setSchemaValidationMode(b ? Validation.STRICT : Validation.STRIP); } else { try { config.setBooleanProperty(feature, b); } catch (IllegalArgumentException err) { throw new XPathFactoryConfigurationException("Unknown or non-boolean feature: " + feature); } } }
/** * Set a feature of this XPath implementation. The features currently * recognized are: * <ul> * <li> {@link XMLConstants#FEATURE_SECURE_PROCESSING} </li> * <li> {@link net.sf.saxon.lib.FeatureKeys#SCHEMA_VALIDATION}: requests schema validation of source documents. * The property is rejected if the configuration is not schema-aware. </li> * </ul> * <p>In addition, any Saxon configuration feature (listed in {@link FeatureKeys} can be used * provided the value is a boolean. (For non-boolean configuration properties, drop down to the underlying * Saxon {@link Configuration} object and call <code>setConfigurationProperty()</code>)</p> * * @param feature a URI identifying the feature * @param b true to set the feature on, false to set it off * @throws XPathFactoryConfigurationException * if the feature name is not recognized */ public void setFeature(String feature, boolean b) throws XPathFactoryConfigurationException { if (feature.equals(FEATURE_SECURE_PROCESSING)) { config.setBooleanProperty(Feature.ALLOW_EXTERNAL_FUNCTIONS, !b); } else if (feature.equals(FeatureKeys.SCHEMA_VALIDATION)) { config.setSchemaValidationMode(b ? Validation.STRICT : Validation.STRIP); } else { try { config.setBooleanProperty(feature, b); } catch (IllegalArgumentException err) { throw new XPathFactoryConfigurationException("Unknown or non-boolean feature: " + feature); } } }
throw new IllegalArgumentException("SCHEMA_VALIDATION must be an integer"); setSchemaValidationMode(((Integer)value).intValue());
throw new IllegalArgumentException("SCHEMA_VALIDATION must be an integer"); setSchemaValidationMode(((Integer)value).intValue()); throw new IllegalArgumentException("SCHEMA_VALIDATION_MODE must be a string"); setSchemaValidationMode(Validation.getCode((String)value));
quit("The -val option requires a schema-aware processor", 2); } else if (value == null || "strict".equals(value)) { config.setSchemaValidationMode(Validation.STRICT); } else if ("lax".equals(value)) { config.setSchemaValidationMode(Validation.LAX); } else { badUsage(command, "-val option must be 'strict' or 'lax'"); } else if (option.equals("vlax")) { if (schemaAware) { config.setSchemaValidationMode(Validation.LAX); } else { quit("The -vlax option requires a schema-aware processor", 2);
quit("The -val option requires a schema-aware processor", 2); } else if (value == null || "strict".equals(value)) { config.setSchemaValidationMode(Validation.STRICT); } else if ("lax".equals(value)) { config.setSchemaValidationMode(Validation.LAX); } else { badUsage(command, "-val option must be 'strict' or 'lax'"); } else if (option.equals("vlax")) { if (schemaAware) { config.setSchemaValidationMode(Validation.LAX); } else { quit("The -vlax option requires a schema-aware processor", 2);
configuration.setSchemaValidationMode(Validation.SKIP); List<OScope.Variable> variables = _compilerContext.getAccessibleVariables(); Map<QName, QName> variableTypes = new HashMap<QName, QName>();
configuration.setSchemaValidationMode(Validation.SKIP); xqconn.setStaticContext(staticEnv);
throw new IllegalArgumentException("SCHEMA_VALIDATION must be an integer"); setSchemaValidationMode((Integer) v); break; throw new IllegalArgumentException("SCHEMA_VALIDATION_MODE must be a string"); setSchemaValidationMode(Validation.getCode((String) value)); break;
setSchemaValidationMode(requireInteger(feature.name, value)); break; setSchemaValidationMode(Validation.getCode(mode)); break;