Matin Tous,Afficher les données XML avec ASP classique
J'ai du mal à faire fonctionner ce code. J'ai passé des heures à l'accorder, à le modifier ... et ça ne marchera toujours pas.
<%
Dim nTitle, nDescription, nWeight, nImage, nPrice, StoreMemberID, nDobaID, StoreItemCatID, nTrue, nFalse, MarkupPerc, nYes, nNo
Dim nFileName, intNewID, paryProducts
FUNCTION FetchProductRecords(str)
Dim objHTTP, RSSURL, RSSFeed, xmlRSSFeed, RSSItems, objItem, objChild, paryOut, nCell
Redim paryOut(6,-1)
nCell = 0
RSSURL = "http://www.storeboard.com/excel/" & str
Set objHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP")
objHTTP.open "GET",RSSURL,false
objHTTP.send
RSSFeed = objHTTP.responseText
Set xmlRSSFeed = Server.CreateObject("MSXML2.DomDocument")
xmlRSSFeed.async = false
xmlRSSFeed.LoadXml(RSSFeed)
Set objHTTP = Nothing
Set RSSItems = xmlRSSFeed.getElementsByTagName("Row")
Set xmlRSSFeed = Nothing
Redim preserve paryOut(6,RSSItems.length-1)
FOR i = 0 TO RSSItems.length - 1
Set RSSItem = RSSItems.Item(i)
FOR EACH objChild IN RSSItem.childNodes
IF nCell = 3 THEN
paryOut(0,i) = objChild.text
ELSEIF nCell = 5 THEN
paryOut(1,i) = objChild.text
ELSEIF nCell = 7 THEN
paryOut(2,i) = objChild.text
ELSEIF nCell = 27 THEN
paryOut(3,i) = objChild.text
ELSEIF nCell = 23 THEN
paryOut(4,i) = objChild.text
ELSEIF nCell = 40 THEN
paryOut(5,i) = objChild.text
END IF
nCell = nCell + 1
NEXT
nCell = 0
NEXT
FetchProductRecords = paryOut
END FUNCTION
paryProducts = FetchProductRecords(nFileName)
IF isArray(paryProducts) THEN
%>
<table cellpadding="0" cellspacing="0" border="1" width="100%">
<tr style="background-color:#000000;color:#FFFFFF;font-weight:bold;font-family:Arial, Helvetica, sans-serif;font-size:10px">
<td style="padding:5px" align="center">DOBA ID</td>
<td style="padding:5px" align="center">TITLE</td>
<td style="padding:5px" align="center">DESCRIPTION</td>
<td style="padding:5px" align="center">PRICE</td>
<td style="padding:5px" align="center">WEIGHT</td>
<td style="padding:5px" align="center">IMAGE</td>
</tr>
<% FOR i = 0 TO uBound(paryProducts,2) %>
<% IF i > 0 THEN ' to avoid the header %>
<tr style="font-family:Arial, Helvetica, sans-serif;font-size:10px">
<td style="padding:5px"><%=paryProducts(0,i)%></td>
<td style="padding:5px"><%=paryProducts(1,i)%></td>
<td style="padding:5px"><%=paryProducts(2,i)%></td>
<td style="padding:5px"><%=paryProducts(3,i)%></td>
<td style="padding:5px"><%=paryProducts(4,i)%></td>
<td style="padding:5px"><%=paryProducts(5,i)%></td>
</tr>
<% END IF %>
<% NEXT %>
</table>
<% END IF %>
Dans l'ensemble, le fichier XML contient 40 champs. Vous pouvez consulter le fichier xml ici: http://www.storeboard.com/excel/cameras2.xml
J'apprécierais toute aide avec ce code afin que je puisse enfin terminer.
ont un grand jour et un Joyeux Noël, Paul
Cela fonctionne également sur ma machine, mais je ne pense pas que ce soit le problème de @ neojakey car une inspection plus poussée des données permet de voir que les numéros de cellules ne correspondent pas. Cela suppose bien sûr que son application ne prenne pas le temps d'extraire le fichier XML de 1,17 Mo. ;-) – stealthyninja
@stealthyninja, le fichier semble avoir expiré/supprimé :( –