Class: Saxon::XPath::Compiler
- Inherits:
-
Object
- Object
- Saxon::XPath::Compiler
- Extended by:
- Forwardable
- Defined in:
- lib/saxon/xpath/compiler.rb
Overview
Compiles XPath expressions so they can be executed
Instance Attribute Summary collapse
-
#declared_namespaces ⇒ Hash<String => String>
readonly
Declared namespaces as prefix => URI hash.
-
#declared_variables ⇒ Hash<Saxon::QName => Saxon::XPath::VariableDeclaration>
readonly
Declared variables as QName => Declaration hash.
-
#default_collation ⇒ String
readonly
The URI of the default declared collation.
Class Method Summary collapse
-
.create(processor) { ... } ⇒ Saxon::XPath::Compiler
Create a new
XPath::Compilerusing the supplied Processor.
Instance Method Summary collapse
-
#compile(expression) ⇒ Saxon::XPath::Executable
The executable query.
- #create(&block) ⇒ Object
-
#initialize(s9_processor, static_context) ⇒ Compiler
constructor
private
A new instance of Compiler.
Constructor Details
#initialize(s9_processor, static_context) ⇒ Compiler
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 Compiler.
31 32 33 |
# File 'lib/saxon/xpath/compiler.rb', line 31 def initialize(s9_processor, static_context) @s9_processor, @static_context = s9_processor, static_context end |
Instance Attribute Details
#declared_namespaces ⇒ Hash<String => String> (readonly)
Returns declared namespaces as prefix => URI hash.
|
|
# File 'lib/saxon/xpath/compiler.rb', line 36
|
#declared_variables ⇒ Hash<Saxon::QName => Saxon::XPath::VariableDeclaration> (readonly)
Returns declared variables as QName => Declaration hash.
|
|
# File 'lib/saxon/xpath/compiler.rb', line 36
|
#default_collation ⇒ String (readonly)
Returns the URI of the default declared collation.
|
|
# File 'lib/saxon/xpath/compiler.rb', line 36
|
Class Method Details
.create(processor) { ... } ⇒ Saxon::XPath::Compiler
Create a new XPath::Compiler using the supplied Processor. Passing a block gives access to a DSL for setting up the compiler’s static context.
16 17 18 19 |
# File 'lib/saxon/xpath/compiler.rb', line 16 def self.create(processor, &block) static_context = XPath::StaticContext.define(block) new(processor.to_java, static_context) end |
Instance Method Details
#compile(expression) ⇒ Saxon::XPath::Executable
Returns the executable query.
45 46 47 |
# File 'lib/saxon/xpath/compiler.rb', line 45 def compile(expression) Saxon::XPath::Executable.new(new_compiler.compile(expression), static_context) end |
#create(&block) ⇒ Object
49 50 51 52 |
# File 'lib/saxon/xpath/compiler.rb', line 49 def create(&block) new_static_context = static_context.define(block) self.class.new(@s9_processor, new_static_context) end |