Sha256: 382abfa0f125496658e7a79d43912ba386679e69c516af027b2666cbb53af6f1

Contents?: true

Size: 634 Bytes

Versions: 2

Compression:

Stored size: 634 Bytes

Contents

module CqmValidators
      module Schema
        class Validator
          include BaseValidator
  
          def initialize(name, schema_file)
            @name = name
            @schema_file = schema_file
            @xsd = Nokogiri::XML::Schema(File.new(@schema_file))
          end
  
          # Validate the document against the configured schema
          def validate(document,data={})
            @xsd.errors.clear
            doc = get_document(document)
            @xsd.validate(doc).map do |error|
              build_error(error.message, "/", data[:file_name])
            end
          end
        end
      end
end
  

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cqm-validators-0.1.1 lib/schema_validator.rb
cqm-validators-0.1.0 lib/schema_validator.rb