Class: OmfCommon::RelaxNGSchema
- Inherits:
-
Object
- Object
- OmfCommon::RelaxNGSchema
- 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
-
#initialize ⇒ RelaxNGSchema
constructor
A new instance of RelaxNGSchema.
- #validate(document) ⇒ Object
Constructor Details
#initialize ⇒ RelaxNGSchema
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 |