Hola:
Retocando un poco tu código:
Código:
if (xml.getElementsByTagName('nombre')[contador].hasChildNodes())
document.getElementById("registro").innerHTML ='<p>'+ xml.getElementsByTagName('nombre')[contador].firstChild.nodeValue+'</p>';
else
document.getElementById("registro").innerHTML ='<p>nombre inexistente</p>';
Saludos