Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mullermp committed Aug 5, 2024
1 parent d7e199e commit c8e77f5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 7 additions & 3 deletions gems/aws-sdk-core/lib/aws-sdk-core/xml/parser/nokogiri_engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ def initialize(stack)
end

def parse(xml)
p = Nokogiri::XML::SAX::Parser.new(self)
p.parse(xml) do |ctx|
parser = Nokogiri::XML::SAX::Parser.new(self)
parser.parse(xml) do |ctx|
ctx.recovery = true
end
end
Expand Down Expand Up @@ -41,7 +41,11 @@ def end_element_namespace(*ignored)
end

def error(msg)
@stack.error(msg)
if msg =~ /PCDATA invalid Char value (\d+)/
@stack.text([Regexp.last_match(1).to_i].pack('U*'))
else
@stack.error(msg)
end
end

end
Expand Down
4 changes: 3 additions & 1 deletion gems/aws-sdk-core/spec/aws/xml/parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,9 @@ def parse(xml, to_h = true)
expect(parse(xml)).to eq(string: 'a', nested: { string: 'b' })
end

it 'handles boundary characters' do
it 'handles backspace characters' do
skip 'Unable to support' if engine == :libxml

xml = "<xml><String>foo\bbar</String></xml>"
expect(parse(xml)).to eq(string: "foo\bbar")
end
Expand Down

0 comments on commit c8e77f5

Please sign in to comment.