class DocbookXslWrapper::Validate

Attributes

document[R]
errors[RW]
schema[R]

Public Class Methods

new(xml) click to toggle source
# File lib/docbook_xsl_wrapper/validate.rb, line 8
def initialize(xml)
  @document = Nokogiri::XML(xml)
  @schema   = Nokogiri::XML::RelaxNG(File.open(File.join(GEM_PATH, 'schema', 'docbookxi.rng'), 'rb'))
  @errors   = ''
end

Public Instance Methods

valid?() click to toggle source
# File lib/docbook_xsl_wrapper/validate.rb, line 14
def valid?
  @errors = schema.validate(document)

  return true if errors.empty?
  false
end