Module: Muddle::Filter::SchemaValidation

Defined in:
lib/muddle/filter/schema_validation.rb

Class Method Summary collapse

Class Method Details

.filter(body_string) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/muddle/filter/schema_validation.rb', line 4

def self.filter(body_string)
  doc = Nokogiri::HTML(body_string)
  doc.encoding = 'UTF-8'

  if doc.internal_subset.nil?
    doc.create_internal_subset("html", "-//W3C//DTD XHTML 1.0 Strict//EN", "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd")
  end

  doc.to_xhtml(:encoding => 'US-ASCII')
end