/** * Get a configuration option * @param name the name of the option required. The names of the options available are listed * as constants in class {@link net.sf.saxon.FeatureKeys} * @return the value of the option to be set. The type of the value depends on the option * that is being set * @throws IllegalArgumentException if the property name is not recognized */ public Object getConfigurationProperty(String name) { return config.getConfigurationProperty(name); }
/** * Get the value of a configuration property * * @param feature the option required. The names of the properties available are listed * as constants in class {@link net.sf.saxon.lib.Feature}. * @return the value of the property, if one is set; or null if the property is unset and there is * no default. * @since 9.9 introduced to give a faster and type-safe alternative to * {@link #getConfigurationProperty(String)} */ /*@Nullable*/ public <T> T getConfigurationProperty(Feature<T> feature) { return config.getConfigurationProperty(feature); }
/** * Get the value of a configuration property * * @param name the name of the option required. The names of the properties available are listed * as constants in class {@link net.sf.saxon.lib.FeatureKeys}. * @return the value of the property, if one is set; or null if the property is unset and there is * no default. * @throws IllegalArgumentException if the property name is not recognized * @deprecated since 9.9 - use {@link #getConfigurationProperty(Feature)} */ /*@Nullable*/ public Object getConfigurationProperty(/*@NotNull*/ String name) { return config.getConfigurationProperty(name); }
/** * Get the value of a configuration property * * @param feature the option required. The names of the properties available are listed * as constants in class {@link net.sf.saxon.lib.Feature}. * @return the value of the property, if one is set; or null if the property is unset and there is * no default. * @since 9.9 introduced to give a faster and type-safe alternative to * {@link #getConfigurationProperty(String)} */ /*@Nullable*/ public <T> T getConfigurationProperty(Feature<T> feature) { return config.getConfigurationProperty(feature); }
/** * Get the value of a configuration property * * @param name the name of the option required. The names of the properties available are listed * as constants in class {@link net.sf.saxon.lib.FeatureKeys}. * @return the value of the property, if one is set; or null if the property is unset and there is * no default. * @throws IllegalArgumentException if the property name is not recognized * @deprecated since 9.9 - use {@link #getConfigurationProperty(Feature)} */ /*@Nullable*/ public Object getConfigurationProperty(/*@NotNull*/ String name) { return config.getConfigurationProperty(name); }
/** * Allows the user to retrieve specific attributes on the underlying * implementation. * @param name The name of the attribute. This must be one of the constants * defined in class {@link net.sf.saxon.FeatureKeys}. * @return value The value of the attribute. * @throws IllegalArgumentException thrown if the underlying * implementation doesn't recognize the attribute. */ public Object getAttribute(String name) throws IllegalArgumentException{ if (name.equals(FeatureKeys.CONFIGURATION)) { return config; } else { return config.getConfigurationProperty(name); } }
/** * Allows the user to retrieve specific attributes on the underlying * implementation. * @param name The name of the attribute. This must be one of the constants * defined in class {@link net.sf.saxon.FeatureKeys}. * @return value The value of the attribute. * @throws IllegalArgumentException thrown if the underlying * implementation doesn't recognize the attribute. */ public Object getAttribute(String name) throws IllegalArgumentException{ if (name.equals(FeatureKeys.CONFIGURATION)) { return config; } else { return config.getConfigurationProperty(name); } }
/** * Get the XPath language level supported, as an integer (being the actual version * number times ten). In Saxon 9.9, for XSLT, the possible values are * 30 (XPath 3.0), 31 (XPath 3.1), and 305 (XPath 3.0 plus the extensions defined in XSLT 3.0). * * @return the XPath language level; the return value will be either 30, 305, or 31 * @since 9.7 */ public int getXPathVersion() { return getConfiguration().getConfigurationProperty(Feature.XPATH_VERSION_FOR_XSLT); }
/** * Get the XPath language level supported, as an integer (being the actual version * number times ten). In Saxon 9.9, for XSLT, the possible values are * 31 (XPath 3.1), and 305 (XPath 3.0 plus the extensions defined in XSLT 3.0). * * @return the XPath language level; the return value will be either 305, or 31 * @since 9.7 */ public int getXPathVersion() { int lang = getConfiguration().getConfigurationProperty(Feature.XPATH_VERSION_FOR_XSLT); return lang == 30 ? 305 : 31; }
/** * Allows the user to retrieve specific attributes on the underlying * implementation. * * @param name The name of the attribute. This must be one of the constants * defined in class {@link net.sf.saxon.lib.FeatureKeys}. * @return value The value of the attribute. * @throws IllegalArgumentException thrown if the underlying * implementation doesn't recognize the attribute. */ /*@Nullable*/ public Object getAttribute(String name) throws IllegalArgumentException { return getConfiguration().getConfigurationProperty(name); }
/** * Allows the user to retrieve specific attributes on the underlying * implementation. * * @param name The name of the attribute. This must be one of the constants * defined in class {@link net.sf.saxon.lib.FeatureKeys}. * @return value The value of the attribute. * @throws IllegalArgumentException thrown if the underlying * implementation doesn't recognize the attribute. */ /*@Nullable*/ public Object getAttribute(String name) throws IllegalArgumentException { return getConfiguration().getConfigurationProperty(name); }
/** * Get a property of the configuration * * @param name the name of the required property. See the class {@link FeatureKeys} for * constants representing the property names that can be requested. * @return the value of the property. Note that boolean values are returned as a Boolean, * even if the value was supplied as a string (for example "true" or "on"). * @throws IllegalArgumentException thrown if the property is not one that Saxon recognizes. */ /*@NotNull*/ public Object getConfigurationProperty(String name) { Feature<?> feature = Feature.byName(name); if (feature == null) { throw new IllegalArgumentException("Unknown configuration property " + name); } else { return getConfigurationProperty(feature); } }
boolean processStreamableAtt(String streamableAtt) { boolean streamable = processBooleanAttribute("streamable", streamableAtt); if (streamable) { if (!getConfiguration().isLicensedFeature(Configuration.LicenseFeature.ENTERPRISE_XSLT)) { compileWarning("Request for streaming ignored: this Saxon configuration does not support streaming", SaxonErrorCode.SXST0068); return false; } if ("off".equals(getConfiguration().getConfigurationProperty(Feature.STREAMABILITY))) { compileWarning("Request for streaming ignored: streaming is disabled in this Saxon configuration", SaxonErrorCode.SXST0068); return false; } } return streamable; }
/** * Set the pipeline configuration * @param pipe the pipeline configuration. This holds a reference to the Saxon configuration, as well as * information that can vary from one pipeline to another, for example the LocationProvider which resolves * the location of events in a source document */ public void setPipelineConfiguration(PipelineConfiguration pipe) { this.pipe = pipe; pipe.setLocationProvider(localLocator); Configuration config = pipe.getConfiguration(); pool = config.getNamePool(); ignoreIgnorable = config.getStripsWhiteSpace() != Whitespace.NONE; retainDTDAttributeTypes = config.isRetainDTDAttributeTypes(); suppressDTDAttributeDefaults = !pipe.isExpandAttributeDefaults(); Boolean b = (Boolean)config.getConfigurationProperty(FeatureKeys.USE_PI_DISABLE_OUTPUT_ESCAPING); allowDisableOutputEscaping = b.booleanValue(); }
boolean processStreamableAtt(String streamableAtt) { boolean streamable = processBooleanAttribute("streamable", streamableAtt); if (streamable) { if (!getConfiguration().isLicensedFeature(Configuration.LicenseFeature.ENTERPRISE_XSLT)) { compileWarning("Request for streaming ignored: this Saxon configuration does not support streaming", SaxonErrorCode.SXST0068); return false; } if ("off".equals(getConfiguration().getConfigurationProperty(Feature.STREAMABILITY))) { compileWarning("Request for streaming ignored: streaming is disabled in this Saxon configuration", SaxonErrorCode.SXST0068); return false; } } return streamable; } /**
/** * Set the pipeline configuration * @param pipe the pipeline configuration. This holds a reference to the Saxon configuration, as well as * information that can vary from one pipeline to another, for example the LocationProvider which resolves * the location of events in a source document */ public void setPipelineConfiguration(PipelineConfiguration pipe) { this.pipe = pipe; pipe.setLocationProvider(localLocator); Configuration config = pipe.getConfiguration(); pool = config.getNamePool(); ignoreIgnorable = config.getStripsWhiteSpace() != Whitespace.NONE; retainDTDAttributeTypes = config.isRetainDTDAttributeTypes(); suppressDTDAttributeDefaults = !pipe.isExpandAttributeDefaults(); Boolean b = (Boolean)config.getConfigurationProperty(FeatureKeys.USE_PI_DISABLE_OUTPUT_ESCAPING); allowDisableOutputEscaping = b.booleanValue(); }
/** * Set the pipeline configuration * @param pipe the pipeline configuration. This holds a reference to the Saxon configuration, as well as * information that can vary from one pipeline to another, for example the LocationProvider which resolves * the location of events in a source document */ public void setPipelineConfiguration(PipelineConfiguration pipe) { this.pipe = pipe; pipe.setLocationProvider(localLocator); Configuration config = pipe.getConfiguration(); pool = config.getNamePool(); ignoreIgnorable = config.getStripsWhiteSpace() != Whitespace.NONE; retainDTDAttributeTypes = config.isRetainDTDAttributeTypes(); suppressDTDAttributeDefaults = !pipe.isExpandAttributeDefaults(); Boolean b = (Boolean)config.getConfigurationProperty(FeatureKeys.USE_PI_DISABLE_OUTPUT_ESCAPING); allowDisableOutputEscaping = b.booleanValue(); }
private static StringValue getVariable(StringValue environVar, XPathContext context) { EnvironmentVariableResolver resolver = context.getConfiguration().getConfigurationProperty( Feature.ENVIRONMENT_VARIABLE_RESOLVER); String environVarName = environVar.getStringValue(); String environValue = ""; if (context.getConfiguration().getBooleanProperty(Feature.ALLOW_EXTERNAL_FUNCTIONS)) { try { environValue = resolver.getEnvironmentVariable(environVarName); if (environValue == null) { return null; } } catch (SecurityException | NullPointerException e) { // no action; } } return new StringValue(environValue); }
private static StringValue getVariable(StringValue environVar, XPathContext context) { EnvironmentVariableResolver resolver = context.getConfiguration().getConfigurationProperty( Feature.ENVIRONMENT_VARIABLE_RESOLVER); String environVarName = environVar.getStringValue(); String environValue = ""; if (context.getConfiguration().getBooleanProperty(Feature.ALLOW_EXTERNAL_FUNCTIONS)) { try { environValue = resolver.getEnvironmentVariable(environVarName); if (environValue == null) { return null; } } catch (SecurityException | NullPointerException e) { // no action; } } return new StringValue(environValue); }
/** * Set the pipeline configuration * * @param pipe the pipeline configuration. This holds a reference to the Saxon configuration, as well as * information that can vary from one pipeline to another */ public void setPipelineConfiguration(PipelineConfiguration pipe) { this.pipe = pipe; Configuration config = pipe.getConfiguration(); ignoreIgnorable = pipe.getParseOptions().getSpaceStrippingRule() != NoElementsSpaceStrippingRule.getInstance(); retainDTDAttributeTypes = config.getBooleanProperty(Feature.RETAIN_DTD_ATTRIBUTE_TYPES); if (!pipe.getParseOptions().isExpandAttributeDefaults()) { defaultedAttributesAction = -1; } else if (config.getBooleanProperty(Feature.MARK_DEFAULTED_ATTRIBUTES)) { defaultedAttributesAction = +1; } allowDisableOutputEscaping = config.getConfigurationProperty(Feature.USE_PI_DISABLE_OUTPUT_ESCAPING); lineNumbering = pipe.getParseOptions().isLineNumbering(); }