function addControlledVocabulary($doc, $submissionNode, $controlledVocabulariesNodeName, $controlledVocabularyNodeName, $controlledVocabulary)
{
$deployment = $this->getDeployment();
$locales = array_keys($controlledVocabulary);
foreach ($locales as $locale) {
if (!empty($controlledVocabulary[$locale])) {
$controlledVocabulariesNode = $doc->createElementNS($deployment->getNamespace(), $controlledVocabulariesNodeName);
$controlledVocabulariesNode->setAttribute('locale', $locale);
foreach ($controlledVocabulary[$locale] as $controlledVocabularyItem) {
$controlledVocabulariesNode->appendChild($node = $doc->createElementNS($deployment->getNamespace(), $controlledVocabularyNodeName, htmlspecialchars($controlledVocabularyItem, ENT_COMPAT, 'UTF-8')));
}
$submissionNode->appendChild($controlledVocabulariesNode);
}
}
}