Ver Mensaje Individual
  #2 (permalink)  
Antiguo 09/09/2014, 02:14
Avatar de angel_dope
angel_dope
 
Fecha de Ingreso: noviembre-2002
Ubicación: Valencia
Mensajes: 737
Antigüedad: 21 años, 5 meses
Puntos: 8
Respuesta: Problemas al procesar XML

Bueno, esto ya lo tengo resuelto. Cómo se cuales son los títulos de las secciones que busco, simplemente he hecho que por cada ITEM se recorran todas las secciones, y si coinciden con lo que busco, las muestra. Dejo el código por si a alguien le viene bien.

Código ASP:
Ver original
  1. set objXml = server.CreateObject("MSXML2.DOMDocument")
  2.     objxml.async = false
  3.    
  4.     ' Aqui cargamos el archivo en el objeto
  5.     objxml.load(server.mappath("./tmp/xml_wm.xml"))
  6.    
  7.     ' Gestion de errores
  8.     if objxml.parseError.errorCode <> 0 Then
  9.             response.Write("Error de Lectura (Por favor, ponerse en contacto con el webmaster).<br />FilePos: " & objxml.parseError.filepos & "<br /> Línea: " & objxml.parseError.Line & "<br /> Causa: " & objxml.parseError.reason & "<br /> Ocurrió en: " & objxml.parseError.srcText & "<br /> Archivo: " & objxml.parseError.URL)
  10.             response.End()
  11.     end if
  12.     numNoticias = objxml.selectSingleNode("/rss/channel").childNodes.length
  13.     if numNoticias <= 5 then
  14.         numnoticias = 0
  15.     else
  16.         for n = 9 to 13
  17.             i=0
  18.             j=0
  19.             while j=0
  20.                 if objxml.selectSingleNode("/rss/channel").childNodes(n).childNodes(i).tagname = "title" then
  21.                     response.write "titulo = " & objxml.selectSingleNode("/rss/channel").childNodes(n).childNodes(i).text
  22.                     j=1
  23.                 end if
  24.                 i=i+1
  25.             wend
  26.             i=0
  27.             j=0
  28.             while not j<>0
  29.                 if objxml.selectSingleNode("/rss/channel").childNodes(n).childNodes(i).tagname = "link" then
  30.                     response.write "<br>enlace = " & objxml.selectSingleNode("/rss/channel").childNodes(n).childNodes(i).text
  31.                     j=1
  32.                 end if
  33.                 i=i+1
  34.             wend
  35.             i=0
  36.             j=0
  37.             while not j<>0
  38.                 if objxml.selectSingleNode("/rss/channel").childNodes(n).childNodes(i).tagname = "description" then
  39.                     response.write "<br>Resumen = " & objxml.selectSingleNode("/rss/channel").childNodes(n).childNodes(i).text
  40.                     j=1
  41.                 end if
  42.                 i=i+1
  43.             wend
  44.             i=0
  45.             j=0
  46.             while not j<>0
  47.                 if objxml.selectSingleNode("/rss/channel").childNodes(n).childNodes(i).tagname = "content:encoded" then
  48.                     response.write "<br><br>Total = " & objxml.selectSingleNode("/rss/channel").childNodes(n).childNodes(i).text
  49.                     j=1
  50.                 end if
  51.                 i=i+1
  52.             wend
  53.            
  54.             response.write "<br><br>"
  55.         next
  56.     end if
__________________
Vayamos por Partes :: Jack el Destripador