You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When parsing an empty tag, the result varies depending on the attributes the element has:
Nori.new.parse('<foo />')#=> {"foo"=>nil}Nori.new.parse('<foo bar />')#=> {}Nori.new.parse('<foo bar="baz"/>')#=> {"foo"=>{"@bar"=>"baz"}}Nori.new.parse('<foo bar="baz">Content</foo>')#=> {"foo"=>"Content"}
It would be handy if there was an option to configure that the parsed response stays consistent (like for string values), even if some information may be lost (e.g. always returning nil, even if there were attributes)
Maybe something like:
Nori.new(ignore_empty_attributes: true).parse('<foo bar />')#=> {"foo"=>nil}
The text was updated successfully, but these errors were encountered:
Thanks for the suggestion. This is less than 100% intuitive and I will update the README with some of these examples so people are not caught off guard.
If you're open to working this I can review the PR. Otherwise it may have to wait until we get through some more housekeeping before I attempt this myself.
When parsing an empty tag, the result varies depending on the attributes the element has:
It would be handy if there was an option to configure that the parsed response stays consistent (like for string values), even if some information may be lost (e.g. always returning
nil
, even if there were attributes)Maybe something like:
The text was updated successfully, but these errors were encountered: