Hola!
Soy nueva en cuestion de usar XML con ASP.
Tengo el siguiente código que dependiendo del contenido en dos XML crear una tabla en html con datos:
Código:
Dim numero_seccion_seleccionada
dim nombre_archivo
Set xmlDoc2 = Server.CreateObject("Microsoft.XMLDOM")
xmlDoc2.async = false
xmlDoc2.setProperty "ServerHTTPRequest", True
xmlDoc2.validateOnParse = False
xmlDoc2.resolveExternals = False
xmlDoc2.load("http://www.mipagina.com.mx/rss/sec.xml")
%>
<% If xmlDoc2.parseError.errorCode <> 0 Then %>
<%= xmlDoc2.parseError.errorCode %>
<br>
<%= xmlDoc2.parseError.reason %>
<br>
<%= xmlDoc2.parseError.line %>
<br>
<% Else
set seccion_seleccionada = xmlDoc2.getElementsByTagName("seleccionado")
set nombres_rss = xmlDoc2.getElementsByTagName("nombreRSS")
End If %>
<%
numero_seccion_seleccionada=seccion_seleccionada.item(0).firstChild.nodeValue
nombre_archivo=nombres_rss.item(numero_seccion_seleccionada).firstChild.nodeValue
nombre_archivo=nombre_archivo & ".xml"
dim xmlTitle
dim xmlLink
dim title
dim link
Set xmlDoc2 = Server.CreateObject("Microsoft.XMLDOM")
xmlDoc2.async = false
xmlDoc2.setProperty "ServerHTTPRequest", True
xmlDoc2.validateOnParse = False
xmlDoc2.resolveExternals = False
xmlDoc2.load("http://www.mipagina.com.mx/rss/"+nombre_archivo)
%>
<% If xmlDoc2.parseError.errorCode <> 0 Then %>
<%= xmlDoc2.parseError.errorCode %>
<br>
<%= xmlDoc2.parseError.reason %>
<br>
<%= xmlDoc2.parseError.line %>
<br>
<% Else
set xmlTitle = xmlDoc2.getElementsByTagName("item/title")
set xmlLink = xmlDoc2.getElementsByTagName("item/link")
End If
%>
<!--- Mancheta TitularesNotícias --->
<table width="138" border="0" cellspacing="0" cellpadding="0" valign="TOP" ID="Table1">
<tr><td width="1" rowspan="3" class="mchor"> </td>
<td width="138" height="1" class="mchor"><img width=1 height=1 /></td>
<td rowspan="3" class="mchor"> </td></tr>
<tr><td class="mch2"> Titulares</td></tr>
<tr><td height="1" class="mchor"><img width=1 height=1 /></td></tr>
</table>
<!--- Imagen--->
<table width="138" border="0" cellspacing="0" cellpadding="0" valign="TOP" ID="Table2">
<tr>
<td rowspan="2" class="tblor"> </td>
<td class="tbl">
<table width="136" border="0" cellspacing="4" cellpadding="0" ID="Table3">
<tr><td height=1 class=spc colspan=2> </td></tr>
<% For n = 0 To xmlTitle.length-1
title = xmlTitle.item(n).firstChild.nodeValue
link=xmlLink.item(n).firstChild.nodeValue
%>
<tr><td width="10" valign="top" class=nar align=right> » </td>
<td class="tx2"><a href="<%= link %>" class="tx2"><%= title %></a></td>
</tr>
<% Next %>
</table>
</td>
<td rowspan="1" class="tblor"> </td>
</tr>
<tr><td height="1" class="tblor"><img width=1 height=1 /></td>
</tr>
<tr><td class="spc" height=14> </td>
</tr>
</table>
Pero me marca el siguiente error:
-2147012889
System error: -2147012889.
0
Microsoft VBScript runtime error '800a01a8'
Object required: 'seccion_seleccionada'
/stage/asp/titulares.asp, line 29
la línea 29 es la siguiente:
Código:
numero_seccion_seleccionada=seccion_seleccionada.item(0).firstChild.nodeValue
Agradezco su ayuda