private static function attributeToNode($oDocument, $oItem, $sAttributeName, $mAttributeValue) { if (is_array($mAttributeValue)) { if (ArrayUtil::arrayIsAssociative($mAttributeValue)) { //Add one element with attributes $oAttribute = $oDocument->createElement($sAttributeName); foreach ($mAttributeValue as $sSubAttributeName => $sSubAttributeValue) { if ($sSubAttributeName === '__content') { $oAttribute->appendChild($oDocument->createTextNode($sSubAttributeValue)); } else { $oAttribute->setAttribute($sSubAttributeName, $sSubAttributeValue); } } $oItem->appendChild($oAttribute); } else { //Add multiple elements with the same name foreach ($mAttributeValue as $mSubAttributeValue) { self::attributeToNode($oDocument, $oItem, $sAttributeName, $mSubAttributeValue); } } } else { self::addSimpleAttribute($oDocument, $oItem, $sAttributeName, $mAttributeValue); } }