Isn\'t that an inconsistent behavior? (PHP 5.2.6)
\');
$a->addAttribute(\'b\', \'One & Two\');
//$a-&
Alan Storm had a nice description of the issue, however there's an easy solution to the paradox he describes. The addChild() method could have an optional boolean parameter that determines whether to automatically escape characters. So, I'm still convinced that it's simply a (very) poor design choice.
The confusion is compounded by the fact the the documentation for the addChild() method makes no reference whatsoever so the issue (although is is in the discussion). Furthermore, the method escapes some characters (namely the less than and greater than signs). This will mislead developers using the method to believe that it escapes characters in general.