Class: OmfCommon::RelaxNGSchema

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

Constant Summary collapse

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

Instance Method Summary collapse

Constructor Details

#initializeRelaxNGSchema

Returns a new instance of RelaxNGSchema.



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

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

Instance Method Details

#validate(document) ⇒ Object



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

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