function addXmlVars($parent, $key, $source)
{
if (empty($source)) {
return;
}
$node = $parent->addChild($key);
foreach ($source as $key => $val) {
$var_node = $node->addChild('var', htmlspecialchars(var_export($val, true)));
$var_node->addAttribute('key', $key);
}
}