This code:

node = XML::Node.new('foo') << XML::Node.new('bar') << "bars contents"

Generates this xml:

puts node
<foo><bar/>bars contents</foo>

That is because the << returns self.

Eric Musgrove if instead it should work like this (see http://rubyforge.org/tracker/?func=detail&atid=1971&aid=21424&group_id=494):

puts node.parent.parent

<foo>
  <bar>bars contents</bar>
<foo>

By making the << operator return the appended node.

<< returning the appended node seems more useful, but doesn't follow the Ruby standard as pointed out by Masashi Shimbo.

Thoughts?

Charlie

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to