Module: Saxon::XDM
- Defined in:
- lib/saxon/xdm.rb,
lib/saxon/xdm/map.rb,
lib/saxon/xdm/item.rb,
lib/saxon/xdm/node.rb,
lib/saxon/xdm/array.rb,
lib/saxon/xdm/value.rb,
lib/saxon/xdm/atomic_value.rb,
lib/saxon/xdm/function_item.rb,
lib/saxon/xdm/sequence_like.rb,
lib/saxon/xdm/empty_sequence.rb,
lib/saxon/xdm/external_object.rb
Overview
Classes for representing, creating, and working with the XPath Data Model type system used in XPath 2+, XSLT 2+, and XQuery.
Defined Under Namespace
Modules: ItemSequenceLike, SequenceLike Classes: Array, AtomicValue, EmptySequence, ExternalObject, FunctionItem, Map, Node, UnhandledItem, Value
Class Method Summary collapse
-
.Array(*args) ⇒ Object
Convenience function for creating a new Array.
-
.AtomicValue(*args) ⇒ Object
Convenience function for creating a new AtomicValue.
-
.EmptySequence ⇒ Object
Returns the XDM EmptySequence.
-
.Item(item) ⇒ Object
Create one of the XdmItem-derived XDM objects from the passed in argument.
-
.Map(*args) ⇒ Object
Convenience function for creating a new Map.
-
.Value(*args) ⇒ Object
Convenience function for creating a new Value.
Class Method Details
.Array(*args) ⇒ Object
Convenience function for creating a new Array. See Saxon::XDM::Array.create
32 33 34 |
# File 'lib/saxon/xdm.rb', line 32 def Array(*args) XDM::Array.create(*args) end |
.AtomicValue(*args) ⇒ Object
Convenience function for creating a new AtomicValue. See Saxon::XDM::AtomicValue.create
17 18 19 |
# File 'lib/saxon/xdm.rb', line 17 def AtomicValue(*args) XDM::AtomicValue.create(*args) end |
.EmptySequence ⇒ Object
Returns the XDM EmptySequence. See Saxon::XDM::EmptySequence.create
27 28 29 |
# File 'lib/saxon/xdm.rb', line 27 def EmptySequence() XDM::EmptySequence.create end |
.Item(item) ⇒ Object
Create one of the XdmItem-derived XDM objects from the passed in argument.
Existing XDM::* objects are passed through. s9api.Xdm* Java objects are wrapped appropriately and returned. Ruby Arrays and Hashes are converted to Array and Map instances respectively. Ruby values that respond to #each
are converted to an Array (e.g. Set). Other Ruby values are converted to AtomicValue.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/saxon/xdm/item.rb', line 10 def self.Item(item) case item when Value, AtomicValue, Node, Array, Map, ExternalObject item when Saxon::S9API::XdmNode Node.new(item) when Saxon::S9API::XdmAtomicValue AtomicValue.new(item) when Saxon::S9API::XdmExternalObject ExternalObject.new(item) when Saxon::S9API::XdmArray Array.new(item) when Saxon::S9API::XdmMap Map.new(item) when Saxon::S9API::XdmValue Value.new(item) when ::Array Array.create(item) when ::Hash Map.create(item) else if item.respond_to?(:each) Array.create(item) else AtomicValue.create(item) end end end |