Class: Saxon::AxisIterator
- Inherits:
-
Object
- Object
- Saxon::AxisIterator
- Includes:
- Enumerable
- Defined in:
- lib/saxon/axis_iterator.rb
Overview
An iterator across an XPath axis of an XDM document, e.g. down to children (child
), up to the root (ancestor
)
Instance Method Summary collapse
-
#each {|the| ... } ⇒ Object
yields each node in the sequence.
-
#initialize(xdm_node, axis) ⇒ AxisIterator
constructor
A new instance of AxisIterator.
-
#to_java ⇒ Saxon::S9API::XdmSequenceIterator
A new Saxon Java XDM sequence iterator.
Constructor Details
#initialize(xdm_node, axis) ⇒ AxisIterator
Returns a new instance of AxisIterator.
16 17 18 19 |
# File 'lib/saxon/axis_iterator.rb', line 16 def initialize(xdm_node, axis) @s9_xdm_node = xdm_node.to_java @s9_axis = Saxon::S9API::Axis.const_get(axis.to_s.upcase.to_sym) end |
Instance Method Details
#each {|the| ... } ⇒ Object
yields each node in the sequence
28 29 30 |
# File 'lib/saxon/axis_iterator.rb', line 28 def each(&block) s9_sequence_iterator.lazy.map { |s9_xdm_node| Saxon::XDM::Node.new(s9_xdm_node) }.each(&block) end |
#to_java ⇒ Saxon::S9API::XdmSequenceIterator
Returns A new Saxon Java XDM sequence iterator.
22 23 24 |
# File 'lib/saxon/axis_iterator.rb', line 22 def to_java s9_sequence_iterator end |