Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skipping all the child tags without raising any errors #85

Open
apsheronets opened this issue Sep 3, 2022 · 0 comments
Open

Skipping all the child tags without raising any errors #85

apsheronets opened this issue Sep 3, 2022 · 0 comments

Comments

@apsheronets
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant