savonrb / nori

XML to Hash translator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

empty_tag_value not obeying xsi:nil ?

l8nite opened this issue · comments

I'd like to get nil when xsi:nil="true", and a blank string when the tag is empty.

irb(main):025:0> parser = Nori.new(empty_tag_value: "")
=> #<Nori:0x00001c2965f690 @options={:strip_namespaces=>false, :delete_namespace_attributes=>false, :convert_tags_to=>nil, :convert_attributes_to=>nil, :empty_tag_value=>"", :advanced_typecasting=>true, :convert_dashes_to_underscores=>true, :parser=>:nokogiri}>
irb(main):026:0> parser.parse('<foo/>')
=> {"foo"=>""}
irb(main):027:0> parser.parse('<foo xsi:nil="true"/>')
=> {"foo"=>""}
irb(main):028:0>