Ver Mensaje Individual
  #2 (permalink)  
Antiguo 14/07/2006, 15:54
rocamo
 
Fecha de Ingreso: julio-2006
Mensajes: 10
Antigüedad: 17 años, 10 meses
Puntos: 0
Espero que te sirva

este es el xml

<?xml version="1.0" ?>
<company>
<employee id="001" sex="M" age="20">Premshree Pillai</employee>
<employee id="002" sex="M" age="24">Kumar Singh</employee>
<employee id="003" sex="M" age="21">Ranjit Kapoor</employee>
<turnover>
<year id="2000">100,000</year>
<year id="2001">140,000</year>
<year id="2002">200,000</year>
</turnover>
</company>

y con esto lo haces

var companies=xmlDoc.getElementsByTagName("company");
var employees=companies[0].getElementsByTagName("employee");
document.write('<table border="1">');
document.write('<tr><th>id</th><th>Sex</th><th>Age</th></tr>');
for(var i=0; i<employees.length; i++) {
document.write('<tr>');
document.write('<td>' + employees[i].getAttribute("id") + '</td>');
document.write('<td>' + employees[i].getAttribute("sex") + '</td>');
document.write('<td>' + employees[i].getAttribute("age") + '</td>');
document.write('</tr>');
}
document.write('<table>');

espero que te sirva