Skip to content

Skipping all the child tags without raising any errors #85

@apsheronets

Description

@apsheronets

In case the underlying XML is not valid. In my case, just having unescaped &

Gemfile:

source "https://rubygems.org"

gem "sax-machine"
gem "nokogiri"

test.rb:

require "sax-machine"

class Child
  include SAXMachine
end

class Parent
  include SAXMachine
  elements :child, as: :children, class: Child
end

p Parent.parse(File.open("xml").read)

xml:

<?xml version="1.0"?>
<parent>
  <child>
    one &
  </child>
  <child>
    two
  </child>
</parent>

And it goes #<Parent:0x000055fef4541cc8> without nor child elements nether error raised.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions