Foros del Web » Creando para Internet » HTML »

leer xml algunos datos en html

Estas en el tema de leer xml algunos datos en html en el foro de HTML en Foros del Web. 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 ...
  #1 (permalink)  
Antiguo 23/07/2008, 17:24
 
Fecha de Ingreso: julio-2008
Mensajes: 1
Antigüedad: 15 años, 8 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.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 22:32.