XML::Node.new('foo') << XML::Node.new('bar') << XML::Node.new('baz')

Should produce:

<foo><bar><baz/></bar></foo>

XML::Node<<(arg) should return the argument being appended *ONLY IF* the argument is an XML::Node, else it should return the xmlNode that had its content modified (e.g. XML::Attributes and Strings).

That should solve this problem.

So in this case the first << returns the 'bar' node and the second << returns the baz node.

Thus:

node = XML::Node.new('foo') << XML::Node.new('bar') << XML::Node.new('baz')

node is baz. Which is annoying, because most of the time I imagine you want foo (at least I want foo). Thus, returning the appended argument is great, until the very end, where you want the original node...

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