Edit in JSFiddle

function mainMenuItems() {
    xmlDoc = LoadXML("/upload/xml/mainmenu.xml");
    x = xmlDoc.getElementsByTagName('tab');
    document.write('<div class="myMenu">');
    for (i = 0; i < x.length; i++) {
        for (k = 0; k < x[i].childNodes.length; k++) {
            if ((x[i].childNodes[k].nodeType != 3) && (x[i].childNodes[k].nodeType != 8)) {
                if (x[i].childNodes[k].nodeName == "menu") menu = x[i].childNodes[k].childNodes[0].nodeValue;
                else if (x[i].childNodes[k].nodeName == "title") name = x[i].childNodes[k].childNodes[0].nodeValue;
            }
        }
        document.write('<div class="buton_Sekil">');
        document.write("<div class=");
        document.write('"rootVoice {menu:');
        document.write("'" + menu + "'}");
        document.write('">');
        document.write(name + "</div>");
        document.write("</div>");
    }
}