credo sia solo un errore di copia
ma quel - prima di <LIBRO> non ci sta bene
non e' un xml valido cosi'
corretto quello, salvando questo
l' output prodotto da IE e ffox e' identico ed e':codice:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title></title> <script type="text/javascript"> var xmlDoc function loadXML(fileName){ // IE if (window.ActiveXObject){ xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async=false; xmlDoc.load(fileName); getmessage(); } // Mozilla & Co. else if (document.implementation && document.implementation.createDocument){ xmlDoc= document.implementation.createDocument("","",null); xmlDoc.load(fileName); xmlDoc.onload=getmessage } // altri browser else { alert('il tuo browser non permette il parsing di file .xml'); } } window.onload=function(){loadXML("libri.xml");} function getmessage(){ var nome = xmlDoc.getElementsByTagName("TITOLO"); var cognome = xmlDoc.getElementsByTagName("AUTORE"); var str = ''; for (var i=0; i<nome.length; i++){ str+=nome[i].childNodes[0].nodeValue + " " + cognome[i].childNodes[0].nodeValue + " "; } document.getElementById('stampa').innerHTML=str; } </script> </head> <body> <div id="stampa"></div> </body> </html>
Come il mare Wilbur Smith
ciao

Rispondi quotando