Inicio > HTML > cblaarc > leer algunos datos xml desde html

leer algunos datos xml desde html

Experto:
Usuario:
Fecha: 24/07/2008
Valoración: (3,00 sobre 5) Categoría: HTML
24/07/2008
natapooh, usuario preguntando en HTML
Usuario
hola cblaarc
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 muestre los titulos de los album y autores que corresponden a ese año.
Podrias 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.getElementsByTagName("ARTIST")[0].childNodes[0].nodeValue);
document.write("</td>");

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

document.write("<td>");
document.write(
x.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.
24/07/2008
natapooh, experto respondiendo en HTML
Experto
ufff
Aquí si que me coges.....
De XML no sé mucho ni sé mucho como acceder a el......
Lo siento
24/07/2008
natapooh, usuario preguntando en HTML
Usuario
Bien. Una respuesta aceptable.
Enlaces patrocinados