
15/08/2008, 12:08
|
 | | | Fecha de Ingreso: abril-2001
Mensajes: 2.249
Antigüedad: 24 años Puntos: 39 | |
Leer XML de otro servidor Hola tengo el siguiente problema:
tengo este archivo XML: <aspxml>
<contents>
<Content><ID>1</ID><evento>Fiestas de la Vendimia</evento><lugar>Ensenada, BCN</lugar><estado>2</estado><fecha>31/08/2008</fecha></Content>
<Content><ID>2</ID><evento>Feria de Santo Domingo</evento><lugar>Tuxtla Gutiérrez, CHIS</lugar><estado>7</estado><fecha>01/08/2008</fecha></Content>
<Content><ID>3</ID><evento>Feria de Santo Domingo de Guzmán</evento><lugar>Palenque, CHIS</lugar><estado>7</estado><fecha>01/08/2008</fecha></Content>
<Content><ID>4</ID><evento>Ferialagos</evento><lugar>Lagos de Moreno, JAL</lugar><estado>15</estado><fecha>01/08/2008</fecha></Content>
<Content><ID>5</ID><evento>Feria Tulancingo</evento><lugar>Tulancingo, HGO</lugar><estado>14</estado><fecha>01/08/2008</fecha></Content>
<Content><ID>6</ID><evento>Feria Nacional Durango 2008</evento><lugar>Durango, DGO</lugar><estado>10</estado><fecha>02/08/2008</fecha></Content>
</contents>
</aspxml>
y lo leo perfectamente con el siguiente codigo en ASP.
<!--#include file="config.asp" -->
<%
dim objXML
set objXML = server.CreateObject("Microsoft.FreeThreadedXMLDOM" )
if request.QueryString("delid") <> "" then
objXML.Load(xmlpath)
set remove = _
objXML.childnodes(0).childnodes(1).childnodes(requ est.QueryString("delid"))
objXML.childnodes(0).childnodes(1).removeChild(rem ove)
objXML.save(xmlpath)
end if
objXML.Load(xmlpath)
set xmlcontents = objXML.DocumentElement.selectSingleNode("contents" )
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Admin Eventos </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<div align="center">
<table width="75%" border="1" bordercolor="#E3E7E8">
<tr>
<td width="16%" bgcolor="#CCCCCC"><font color="#FFFFFF"><strong>Opciones</strong></font></td>
<td width="3%" bgcolor="#CCCCCC"><font color="#FFFFFF" size="2" face="Georgia, Times New Roman, Times, serif"><strong>ID</strong></font></td>
<td width="24%" bgcolor="#CCCCCC"><font color="#FFFFFF" size="2" face="Georgia, Times New Roman, Times, serif"><strong>Evento</strong></font></td>
<td width="29%" bgcolor="#CCCCCC"><font color="#FFFFFF" size="2" face="Georgia, Times New Roman, Times, serif"><strong>Lugar</strong></font></td>
<td width="17%" bgcolor="#CCCCCC"><font color="#FFFFFF" size="2" face="Georgia, Times New Roman, Times, serif"><strong>Estado</strong></font></td>
<td width="11%" bgcolor="#CCCCCC"><font color="#FFFFFF" size="2" face="Georgia, Times New Roman, Times, serif"><strong>Fecha</strong></font></td>
</tr>
<tr>
<td colspan="6"> </td>
</tr>
<%
for i = 0 to xmlcontents.ChildNodes.length - 1
set xmlcontent = xmlcontents.ChildNodes.item(i)
%>
<tr>
<td><a href="newcontent.asp?id=<%= i+1%>">Editar</a> - <a href="?delid=<%= i%>">Suprimir</a></td>
<td><%= xmlcontent.ChildNodes.item(0).text%></td>
<td><%= xmlcontent.ChildNodes.item(1).text%></td>
<td><%= xmlcontent.ChildNodes.item(2).text%></td>
<td><%= xmlcontent.ChildNodes.item(3).text%></td>
<td><%= xmlcontent.ChildNodes.item(4).text%></td>
</tr>
<% next %>
<tr>
<td colspan="6"><div align="right"><a href="newcontent.asp">Agregar</a></div></td>
</tr>
</table>
</div>
</body>
</html>
el archvo config.asp que mando a llamar en el asp es este.
<link href="style.css" rel="stylesheet" type="text/css"> <%
dim xmlpath
xmlpath = server.MapPath("XML/xml.xml")
%>
y todo jala muy bien si es que los archivos estan en el mismo servidor.
Pero cuando pongo el XML en un servidor y los ASP en otro es cuando me marca error: Se especificó un carácter no válido en el parámetro Path del método MapPath.
la linea es esta: xmlpath = server.MapPath("http://solutions.rwa.com.mx/eventos_ford/XML/xml.xml")
/aspxml/config.asp, línea 3
Como puedo llamar un xml externo con este codigo espero me puedan ayudar..
Saludos.. |