savonrb / nori

XML to Hash translator
MIT License
247 stars 74 forks source link

Breaking change between 2.4.0 and 2.6.0 #73

Closed lucaspiller closed 8 months ago

lucaspiller commented 8 years ago

I haven't had chance to investigate what caused this, but after an upgrade from 2.4.0 to 2.6.0, newlines are included in parsed fields.

In our case we are using Savon to talk to an API returning XML in XML. When parsing the embedded XML with Nokogiri, the newlines are mapped to Nokogiri::XML::Text which resulted in obscure errors and much debugging.

> Nori::VERSION
=> "2.4.0"
> Nori.new.parse("<outer>\n&lt;embedded&gt;\n&lt;one&gt;&lt;/one&gt;\n&lt;two&gt;&lt;/two&gt;\n&lt;embedded&gt;\n</outer>")
=> {"outer"=>"<embedded><one></one><two></two><embedded>"}
> Nori::VERSION
=> "2.6.0"
> Nori.new.parse("<outer>\n&lt;embedded&gt;\n&lt;one&gt;&lt;/one&gt;\n&lt;two&gt;&lt;/two&gt;\n&lt;embedded&gt;\n</outer>")
=> {"outer"=>"<embedded>\n<one></one>\n<two></two>\n<embedded>\n"}

I think this change is correct, but please add a note about it somewhere as a breaking change :)

pcai commented 8 months ago

thanks, noted this in https://github.com/savonrb/nori/commit/af36ee6ec77ea8b6f068bce5939210bbbe661d33