Class: OmfCommon::RelaxNGSchema

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
omf_common/lib/omf_common/message/xml/relaxng_schema.rb

Constant Summary

SCHEMA_FILE =
"#{File.dirname(__FILE__)}/../../protocol/#{OmfCommon::PROTOCOL_VERSION}.rng"

Instance Method Summary (collapse)

Constructor Details

- (RelaxNGSchema) initialize

Returns a new instance of RelaxNGSchema



14
15
16
# File 'omf_common/lib/omf_common/message/xml/relaxng_schema.rb', line 14

def initialize
  @rng = File.read(SCHEMA_FILE)
end

Instance Method Details

- (Object) validate(document)



18
19
20
# File 'omf_common/lib/omf_common/message/xml/relaxng_schema.rb', line 18

def validate(document)
  Nokogiri::XML::RelaxNG(@rng).validate(document)
end