No vi lo de ajax. Lo que posteé antes funciona correctamente (lo testeé antes de responderte). Fijate que el xml generado por php tenga los headers que correspondan y no haya errores de parseo. También estar testeándolo en un servidor web. Te dejo mis testeos para que veas:
Código PHP:
<?php
ob_start();
header("Content-type:text/xml");
echo '<';
?>
?xml version="1.0" encoding="utf-8" ?>
<provincia>
<nombre>Gerona</nombre>
<idprovincia>1</idprovincia>
<localidad>Ripoll</localidad>
</provincia>
<?php ob_end_flush(); ?>
Código javascript
:
Ver original<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin título</title>
</head>
<body>
<script>
function importaXML(archivo)
{
var xmlDoc;
// code for IE
if (window.ActiveXObject)
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
}
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument)
{
xmlDoc=document.implementation.createDocument("","",null);
}
else
{
alert('Tu navegador no puede manejar este script');
}
xmlDoc.async=false;
xmlDoc.load(archivo);
return(xmlDoc);
}
function mostrarInfo(){
xmlDoc=importaXML("test.php");
var x = xmlDoc.getElementsByTagName("provincia")[0];
alert(x.getElementsByTagName('nombre')[0].firstChild.data);
}
mostrarInfo()
</script>
</body>
</html>