Sha256: 7a9f82719e6538c5a1ac45cdd07b4d3dc4fa87f0994dba3a703d65fc7bc619b6

Contents?: true

Size: 457 Bytes

Versions: 1

Compression:

Stored size: 457 Bytes

Contents

module DocbookXslWrapper
  class Validate
    attr_accessor :errors

    attr_reader :document, :schema
    private :document, :schema

    def initialize(xml)
      @document = Nokogiri::XML(xml)
      @schema   = Nokogiri::XML::RelaxNG(File.open(File.join(GEM_PATH, 'schema', 'docbookxi.rng'), 'rb'))
      @errors   = ''
    end

    def valid?
      @errors = schema.validate(document)

      return true if errors.empty?
      false
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
docbook_xsl_wrapper-0.5.2 lib/docbook_xsl_wrapper/validate.rb