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

puts node.parent.parent

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

FYI - one downside of returning the appended object as opposed to self is that the variable node above is the "bar contents" node. Thus you have to write:

puts node.parent.parent.

I find that surprising.  It would be nice if node was the top node.

Thus in the example it would be nice for << to return the child object in some cases and self in others. Sigh.

Anyone see a way of getting the best of both worlds?

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