Method: IsoDoc::Function::Utils#to_xhtml

Defined in:
lib/isodoc/function/utils.rb

#to_xhtml(xml) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/isodoc/function/utils.rb', line 48

def to_xhtml(xml)
  xml = to_xhtml_prep(xml)
  begin
    Nokogiri::XML.parse(xml, &:strict)
  rescue Nokogiri::XML::SyntaxError => e
    File.open("#{@filename}.#{@format}.err", "w:UTF-8") do |f|
      f.write xml
    end
    abort "Malformed Output XML for #{@format}: #{e} "\
          "(see #{@filename}.#{@format}.err)"
  end
end