Class: Riddl::Handlers::RelaxNG
- Inherits:
-
Implementation
- Object
- Implementation
- Riddl::Handlers::RelaxNG
- Defined in:
- lib/ruby/riddl/handlers/relaxng.rb
Class Method Summary collapse
Class Method Details
.handle(what, hinfo) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/ruby/riddl/handlers/relaxng.rb', line 4 def self::handle(what,hinfo) w = if what.class == Riddl::Parameter::Tempfile || what.class == File XML::Smart.open_unprotected(what) else XML::Smart.string(what) end rng = XML::Smart.string("<payload>" + hinfo + "</payload>") rng.register_namespace 'r', 'http://relaxng.org/ns/structure/1.0' w.validate_against(rng.find("//r:grammar|//r:element").first.to_doc) rescue false end |