Class: Saxon::Serializer

Inherits:
Object
  • Object
show all
Defined in:
lib/saxon/serializer.rb

Overview

Serialize XDM objects.

Defined Under Namespace

Classes: OutputProperties

Instance Method Summary collapse

Constructor Details

#initialize(s9_serializer) ⇒ Serializer

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 Serializer.



79
80
81
# File 'lib/saxon/serializer.rb', line 79

def initialize(s9_serializer)
  @s9_serializer = s9_serializer
end

Instance Method Details

#output_propertySaxon::Serializer::OutputProperties

Returns hash-like access to the Output Properties.

Returns:



84
85
86
# File 'lib/saxon/serializer.rb', line 84

def output_property
  @output_property ||= OutputProperties.new(s9_serializer)
end

#serialize(xdm_value, io) ⇒ nil #serialize(xdm_value, path) ⇒ nil #serialize(xdm_value) ⇒ String

Overloads:

  • #serialize(xdm_value, io) ⇒ nil

    Serialize an XdmValue to an IO

    Parameters:

    • xdm_value (Saxon::XdmValue)

      The XdmValue to serialize

    • io (File, IO)

      The IO to serialize to

    Returns:

    • (nil)
  • #serialize(xdm_value, path) ⇒ nil

    Serialize an XdmValue to file path

    Parameters:

    • xdm_value (Saxon::XdmValue)

      The XdmValue to serialize

    • path (String, Pathname)

      The path of the file to serialize to

    Returns:

    • (nil)
  • #serialize(xdm_value) ⇒ String

    Serialize an XdmValue to a String

    Parameters:

    Returns:

    • (String)

      The serialized XdmValue



102
103
104
105
106
107
108
109
110
111
# File 'lib/saxon/serializer.rb', line 102

def serialize(xdm_value, io_or_path = nil)
  case io_or_path
  when nil
    serialize_to_string(xdm_value)
  when String, Pathname
    serialize_to_file(xdm_value, io_or_path)
  else
    serialize_to_io(xdm_value, io_or_path)
  end
end

#to_javaSaxon::S9API::Serializer

Returns The underlying Saxon Serializer object.

Returns:

  • (Saxon::S9API::Serializer)

    The underlying Saxon Serializer object



114
115
116
# File 'lib/saxon/serializer.rb', line 114

def to_java
  s9_serializer
end