diff --git a/lib/html2haml/html.rb b/lib/html2haml/html.rb index 80a651a..aca16a1 100644 --- a/lib/html2haml/html.rb +++ b/lib/html2haml/html.rb @@ -159,6 +159,10 @@ def detect_proper_parser(template) return Nokogiri.HTML(template).at('/html').children end + if template =~ /^\s*<\?xml/i + return Nokogiri.XML(template) + end + parsed = Nokogiri::HTML::DocumentFragment.parse(template) #detect missplaced head or body tag