Ver Mensaje Individual
  #1 (permalink)  
Antiguo 23/07/2008, 17:24
NATYPOOH
 
Fecha de Ingreso: julio-2008
Mensajes: 1
Antigüedad: 15 años, 9 meses
Puntos: 0
leer xml algunos datos en html

Tengo un problema... tengo un archivo XML de musica en donde existen autores, titulos del album y fecha en que se lanzo el album, este lo leo por HTML, es decir el codigo en HTML me lee todos los datos del XML y me los muestra.. lo que yo trato de hacer es que no me lea todos los datos si no q por medio de una busqueda por decir de año dentro del html, me arroje los tituloS de los album y autores que corresponden a ese año.

Alguien podria ayudarme es SUPER URGENTE....

ESTE ES EL XML

<?xml version="1.0" encoding="ISO-8859-1" ?>

<CATALOG>
<CD>
<TITLE>Empire Burlesque</TITLE>
<ARTIST>Bob Dylan</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>Columbia</COMPANY>
<PRICE>10.90</PRICE>
<YEAR>1985</YEAR>
</CD>
<CD>
<TITLE>Hide your heart</TITLE>
<ARTIST>Bonnie Tyler</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>CBS Records</COMPANY>
<PRICE>9.90</PRICE>
<YEAR>1988</YEAR>
</CD>
<CD>
<TITLE>Greatest Hits</TITLE>
<ARTIST>Dolly Parton</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>RCA</COMPANY>
<PRICE>9.90</PRICE>
<YEAR>1982</YEAR>
</CD>
<CD>
<TITLE>Still got the blues</TITLE>
<ARTIST>Gary Moore</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>Virgin records</COMPANY>
<PRICE>10.20</PRICE>
<YEAR>1985</YEAR>
</CD>
</CATALOG>

AQUI ESTA EL HTML


<html>
<body>

<script type="text/javascript">
var xmlDoc=null;
if (window.ActiveXObject)

xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
}
else if (document.implementation.createDocument)

xmlDoc=document.implementation.createDocument(""," ",null);
}
else
{
alert('Your browser cannot handle this script');
}
if (xmlDoc!=null)
{
xmlDoc.async=false;
xmlDoc.load("cd_catalog.xml");

document.write("<table border='1'>");

var x=xmlDoc.getElementsByTagName("CD");
for (i=0;i<x.length;i++)
{
document.write("<tr>");
document.write("<td>");
document.write(
x[i].getElementsByTagName("ARTIST")[0].childNodes[0].nodeValue);
document.write("</td>");

document.write("<td>");
document.write(
x[i].getElementsByTagName("TITLE")[0].childNodes[0].nodeValue);
document.write("</td>");

document.write("<td>");
document.write(
x[i].getElementsByTagName("YEAR")[0].childNodes[0].nodeValue);
document.write("</td>");
document.write("</tr>");
}
document.write("</table>");
}
</script>

</body>
</html>


Agradezco la ayuda y si es con un ejemplo mucho mejor.