Skip to content

Commit

Permalink
Merge pull request #171 from mtasaka/rexml-3_3_3-support
Browse files Browse the repository at this point in the history
Support REXML 3.3.3 invalid XML handling
  • Loading branch information
mogest authored Sep 20, 2024
2 parents ba87994 + c9ce352 commit 260685a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/prawn/svg/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ class Prawn::SVG::Document
:color_mode

def initialize(data, bounds, options, font_registry: nil, css_parser: CssParser::Parser.new, attribute_overrides: {})
@root = REXML::Document.new(data).root
begin
@root = REXML::Document.new(data).root
rescue REXML::ParseException
@root = nil
end

if @root.nil?
if data.respond_to?(:end_with?) && data.end_with?('.svg')
Expand Down

0 comments on commit 260685a

Please sign in to comment.