Class: Saxon::Configuration
- Inherits:
-
Object
- Object
- Saxon::Configuration
- Defined in:
- lib/saxon/configuration.rb
Overview
Wraps the net.sf.saxon.Configuration
class.
See netnet.sfnet.sf.saxonnet.sf.saxon.Configuration for details of what configuration options are available and what values they accept.
See netnet.sfnet.sf.saxonnet.sf.saxon.libnet.sf.saxon.lib.FeatureKeys for details of the constant names used to access the values
Class Method Summary collapse
- .create(processor = nil) ⇒ Saxon::Configuration
- .create_licensed(license_path) ⇒ Saxon::Configuration
-
.default ⇒ Saxon::Configuration
Provides a processor with default configuration.
-
.set_licensed_default!(licensed_configuration) ⇒ Object
Set a already-created Licensed Configuration object as the default configuration.
Instance Method Summary collapse
-
#[](option) ⇒ Object
Get a configuration option value.
-
#[]=(option, value) ⇒ Object
Set a configuration option value.
-
#initialize(config) ⇒ Configuration
constructor
private
A new instance of Configuration.
-
#parse_options ⇒ Saxon::ParseOptions
Return the current ParseOptions object See www.saxonica.com/documentation/index.html#!javadoc/net.sf.saxon.lib/ParseOptions for details.
-
#to_java ⇒ net.sf.saxon.Configuration
The underlying Saxon Configuration.
Constructor Details
#initialize(config) ⇒ Configuration
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Configuration.
59 60 61 |
# File 'lib/saxon/configuration.rb', line 59 def initialize(config) @config = config end |
Class Method Details
.create(processor = nil) ⇒ Saxon::Configuration
27 28 29 30 31 32 33 34 35 |
# File 'lib/saxon/configuration.rb', line 27 def self.create(processor = nil) Saxon::Loader.load! if processor config = processor.to_java. else config = Saxon::S9API::Configuration.new end new(config) end |
.create_licensed(license_path) ⇒ Saxon::Configuration
40 41 42 43 44 45 46 |
# File 'lib/saxon/configuration.rb', line 40 def self.create_licensed(license_path) Saxon::Loader.load! java_config = Saxon::S9API::Configuration.makeLicensedConfiguration(nil, nil) config = new(java_config) config[:LICENSE_FILE_LOCATION] = license_path config end |
.default ⇒ Saxon::Configuration
Provides a processor with default configuration. Essentially a singleton instance
19 20 21 22 23 |
# File 'lib/saxon/configuration.rb', line 19 def self.default DEFAULT_SEMAPHORE.synchronize do @config ||= create end end |
.set_licensed_default!(licensed_configuration) ⇒ Object
Set a already-created Licensed Configuration object as the default configuration
50 51 52 53 54 |
# File 'lib/saxon/configuration.rb', line 50 def self.set_licensed_default!(licensed_configuration) DEFAULT_SEMAPHORE.synchronize do @config = licensed_configuration end end |
Instance Method Details
#[](option) ⇒ Object
Get a configuration option value
See Saxon::Configuration.netnet.sfnet.sf.saxonnet.sf.saxon.libnet.sf.saxon.lib.FeatureKeys for details of the available options. Use the constant name as a string or symbol as the option, e.g. :allow_multhreading
, ‘ALLOW_MULTITHREADING’, ‘allow_multithreading’.
73 74 75 |
# File 'lib/saxon/configuration.rb', line 73 def [](option) @config.getConfigurationProperty(option_url(option)) end |
#[]=(option, value) ⇒ Object
Set a configuration option value. See #[] for details about the option names.
85 86 87 88 |
# File 'lib/saxon/configuration.rb', line 85 def []=(option, value) url = option_url(option) @config.setConfigurationProperty(url, value) end |
#parse_options ⇒ Saxon::ParseOptions
Return the current ParseOptions object See www.saxonica.com/documentation/index.html#!javadoc/net.sf.saxon.lib/ParseOptions for details. This allows you to set JAXP features and properties to be passed to the parser
96 97 98 |
# File 'lib/saxon/configuration.rb', line 96 def ParseOptions.new(@config.getParseOptions) end |
#to_java ⇒ net.sf.saxon.Configuration
Returns The underlying Saxon Configuration.
101 102 103 |
# File 'lib/saxon/configuration.rb', line 101 def to_java @config end |