nori
nori copied to clipboard
XML to Hash translator
XML: ``` 12345 ``` Ruby: ``` content = File.read('response.xml') nori = Nori.new(strip_namespaces: true) hash = nori.parse(content) puts hash.inspect ``` Expected: ``` {"Position_Data"=>{"Position_ID"=>"12345", "@Effective_Date"=>"2022-02-01"}} ``` Actual: ``` {"Position_Data"=>{"Position_ID"=>"12345", "@wd:Effective_Date"=>"2022-02-01"}} ```
Hi, is there a way to raise an exception on parsing error? ``` Nori.new.parse(xml_content) ``` No matter what is the content, it never raises anything, it just returns an empty...
Original conversation with @tjarratt started in #50 I'm working with a soap api that has xml text nodes with an attribute. I'm not sure how to pass the hash to...
Analogous to https://github.com/savonrb/savon/commit/39ed9381e8bbc33f91465692d79e16370683472c, with the add'l benefit that it's unused within this gem. (However, it looks like savon has [re-introduced](https://github.com/savonrb/savon/blob/master/lib/savon/qualified_message.rb#L48) a dependency on Object#blank, which I can expunge in a...
If a parse error occurred anywhere inside the XML, the Nokogiri parser just returns whatever happens to be on top of the stack. This makes it very hard to troubleshoot...
Fixes #78 https://github.com/savonrb/nori/pull/64 introduced a confusing error "undefined method" on malformed xmls. This change reraise this error with the proper class and message.
Issue: https://github.com/savonrb/savon/issues/314 Problem: When node is empty, it leaves it as hash and fills it with attributes. This is wrong. I commented line out...
See rubiii/savon#110 for history. Seems nori is forcing Time objects and DateTime objects to utc when doing typecasting. This causes goes against ISO8601 which clearly states that date and time...
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: "") => #false, :delete_namespace_attributes=>false, :convert_tags_to=>nil, :convert_attributes_to=>nil, :empty_tag_value=>"", :advanced_typecasting=>true, :convert_dashes_to_underscores=>true,...
`data = "\n\n 0\n\n" Nori.new.parse data NoMethodError: undefined method 'add_node' for nil:NilClass ` Question sign is omitted at the end of header Expected kind of "Malformed XML" or "Parsing error',...