[libxml-devel] << operator
Sean Chittenden
sean at chittenden.org
Thu Aug 21 15:57:47 EDT 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
> If the argument to << is a string, append to the xmlNode->content
> via xmlNodeAddContent(3). If, however, the argument is an
> XML::Node, then use xmlAddChild(3) to add an xmlNode->child node.
And if it's an atribute:
node1 << XML::Attribute.new('foo','bar')
You'd end up with:
<foo foo="bar"/>
Here's the problem and line that I haven't drawn yet:
node1 << XML::Attribute.new('foo','bar') << 'baz'
What's that produce? '<foo foo="bar"/>baz' or '<foo foo="barbaz"/
>' ?? I think chaining objects together is a common practice and
more convenient than doing one assignment per line, so I'm biased
towards the behavior of the former (not the latter).
Arguments/discussion welcome. -sc
- --
Sean Chittenden
sean at chittenden.org
-----BEGIN PGP SIGNATURE-----
iEYEARECAAYFAkityLsACgkQTrydwWwuXhYKewCgpGTX8ZXP9ydP+Uy/au24K9yu
p44AnRxLg0Mls4eAyXhVjAG6pEa+QRHx
=CZJw
-----END PGP SIGNATURE-----
More information about the libxml-devel
mailing list