Here is my code:
\'); $pro
If you use the new created node you can set the value by accessing {0} property. This should escape any special characters.
$childNode = $parent->addChild($name); $childNode{0} = $value;