module Schematron::Utils

Public Instance Methods

create_temp_file(content, &block) click to toggle source
# File lib/schematron/utils.rb, line 5
def create_temp_file(content, &block)
  temp_file = Tempfile.new('temp_file')
  temp_file.write(content)
  temp_file.rewind

  begin
    block.call(temp_file)
  ensure
    temp_file.close
    temp_file.unlink
  end
end
get_attribute_value(element, xpath) click to toggle source
# File lib/schematron/utils.rb, line 18
def get_attribute_value(element, xpath)
  result = ''
  attributes = element.xpath(xpath)

  if attributes.size > 0
    result = attributes.first.value
  end

  result
end