Empact / roxml

ROXML is a module for binding Ruby classes to XML. It supports custom mapping and bidirectional marshalling between Ruby and XML using annotation-style class methods, via Nokogiri or LibXML.
http://roxml.rubyforge.org/
MIT License
223 stars 176 forks source link

undefined method `each' for "":String in ruby 1.9.3 #47

Closed railsfactory-dhamodharan closed 12 years ago

railsfactory-dhamodharan commented 12 years ago

roxml (3.3.1) lib/roxml/xml/references.rb:179:in block in update_xml' roxml (3.3.1) lib/roxml/xml/references.rb:173:intap' roxml (3.3.1) lib/roxml/xml/references.rb:173:in update_xml' roxml (3.3.1) lib/roxml.rb:42:inblock (2 levels) in to_xml' roxml (3.3.1) lib/roxml.rb:39:in each' roxml (3.3.1) lib/roxml.rb:39:inblock in to_xml' roxml (3.3.1) lib/roxml.rb:35:in tap' roxml (3.3.1) lib/roxml.rb:35:into_xml' roxml (3.3.1) lib/roxml/xml/references.rb:295:in block (2 levels) in update_xml' roxml (3.3.1) lib/roxml/xml/references.rb:294:ineach' roxml (3.3.1) lib/roxml/xml/references.rb:294:in block in update_xml' roxml (3.3.1) lib/roxml/xml/references.rb:291:intap' roxml (3.3.1) lib/roxml/xml/references.rb:291:in update_xml' roxml (3.3.1) lib/roxml.rb:42:inblock (2 levels) in to_xml' roxml (3.3.1) lib/roxml.rb:39:in each' roxml (3.3.1) lib/roxml.rb:39:inblock in to_xml' roxml (3.3.1) lib/roxml.rb:35:in tap' roxml (3.3.1) lib/roxml.rb:35:into_xml'

Need to upgrade as per latest ruby.

Empact commented 12 years ago

So the tests run green - it seems you have an inconsistency between your declarations (which indicate that this attribute should have several values) and your data, which resolves down to a single string. If you provide your declarations and your source data, I can perhaps add this case to the test suite and handle it better.

railsfactory-dhamodharan commented 12 years ago

Parameters passed to update_xml(xml, value) method as following:

Xml  = #<Nokogiri::XML::Element:0x69ec4dc name="SalesRights">02#<Nokogiri::XML::Element:0x69ec4dc name="SalesRights" children=[#<Nokogiri::XML::Element:0x69ebd8e name="SalesRightsType" children=[#<Nokogiri::XML::Text:0x69eb690 "02">]>]>

value = ""
Empact commented 12 years ago

Can you be more clear about how you're using the library? Are you calling #update_xml directly? If so I'd like to understand why, it's not intended to be called directly.

Again, it seems there's an inconsistency between your declarations and the value you're supplying for the attribute. You're giving an empty string for the value, but the reference that you've declared is an array reference.

railsfactory-dhamodharan commented 12 years ago

I apologize for wrong attribute, I have invoked from my customized Onix gem problem from my side.