lib/sepa/utilities.rb
def check_validity_against_schema(doc, schema)
      Dir.chdir(SCHEMA_PATH) do
        xsd = Nokogiri::XML::Schema(IO.read(schema))
        unless doc.respond_to?(:canonicalize) && xsd.valid?(doc)
          errors.add(:base, 'The document did not validate against the schema file')
        end
      end
    end
# Validates whether a doc is valid against a schema. Adds error using ActiveModel validations if
# document is not valid against the schema.
#
# @param doc [Nokogiri::XML::Document] the document to validate
# @param schema [String] name of the schema file in {SCHEMA_PATH}
Validates whether a doc is valid against a schema. Adds error using ActiveModel validations if
document is not valid against the schema.
Validates whether a doc is valid against a schema . Adds error using ActiveModel validations if document is not valid against the schema .
def check_validity_against_schema(doc, schema)
      Dir.chdir(SCHEMA_PATH) do
        xsd = Nokogiri::XML::Schema(IO.read(schema))
        unless doc.respond_to?(:canonicalize) && xsd.valid?(doc)
          errors.add(:base, 'The document did not validate against the schema file')
        end
      end
    end
def check_validity_against_schema ( doc , schema ) Dir . chdir ( SCHEMA_PATH ) do xsd = Nokogiri :: XML :: Schema ( IO . read ( schema ) ) unless doc . respond_to? ( :canonicalize ) && xsd . valid? ( doc ) errors . add ( :base , 'The document did not validate against the schema file' ) end end end
Validates whether a doc is valid against a schema.
Validates whether a doc is valid against a schema .
doc
the document to validate
the document to validate
schema
name of the schema file in {SCHEMA_PATH}
name of the schema file in { SCHEMA_PATH }