Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    recupera rss valuta/cambio aggiornato

    Cari amici,
    ho un piccolo problema

    Sono riuscita a trovare dove posso recuperare prezzo del euro in diverse monete



    solo che non riesco a leggere una parte del file xml

    il codice è questo

    codice:
    <%
    
    rssURL =http://www.bankofcanada.ca/databank/client_output/7833.xml
    
    'Creo l'oggetto DOM XML
    
    Set objXML = Server.CreateObject("msxml2.DOMDocument.3.0")
    
    'Imposto le proprietà dell'oggetto
    
    objXML.async = false
    
    objXML.setProperty "ServerHTTPRequest", True
    
    objXML.validateOnParse =false
    
    objXML.preserveWhiteSpace = false
    
    'Carico il file RSS dalla URL
    
    rssFile = objXML.Load(rssURL)
    
    
    
    'Se ci sono errori stampo a video
    
    If Not rssFile Then
    
    Response.write "ERRORE..."
    
    'Se NON ci sono errori proseguo...
    
    Else
    
    'Recupero i dati dai nodi Item (e sotto nodi)
    
    Set objNodeList = objXML.getElementsByTagName("Currency_name") 
    
    
    
     For Each objNode In objNodeList
    
    For Each objNode2 In objNode.childNodes
    
    
    
    Select Case objNode2.nodeName
    
    
    
    
    
    
    
    Case "Observation_data"
    
    strv1 = objNode2.firstChild.nodevalue
    
    Case "Observation_data"
    
    strv2 = objNode2.firstChild.nodevalue
    
    Case "Observation_data"
    
    strv3 = objNode2.firstChild.nodevalue
    
    End Select
    
    Next
    
    Response.write strv1&" - "&strv2&" - "&strv3&"
    "
    
    
    
     'azzero tutto per il prossimo passaggio
    
    strv1 = ""
    
    strv2 = ""
    
    strv3 = ""
    
    'end if
    
    Next
    
    %>
    in questo script vorrei recuperare la cifra che è su strv2 o strv3

    il problema è che ci sono tre targe Observation_data uguale

    Aiutto!

  2. #2
    A te ... testato e funzionante.

    codice:
    <%
    dim arrObservation(3)
    dim indexArrayObservation 
    
    rssURL ="http://www.bankofcanada.ca/databank/client_output/7833.xml"
    
    Set objXML = Server.CreateObject("msxml2.DOMDocument.3.0")
    
    objXML.async = false
    objXML.setProperty "ServerHTTPRequest", True
    objXML.validateOnParse =false
    objXML.preserveWhiteSpace = false
    rssFile = objXML.Load(rssURL)
    If Not rssFile Then
                 Response.write "ERRORE..."
    Else
    	Set objNodeList = objXML.getElementsByTagName("Currency_name") 
    	For Each objNode In objNodeList
    		For Each objNode2 In objNode.childNodes
    			if objNode2.nodeName="Observation_data" then
    			   arrObservation(indexArrayObservation)=objNode2.firstChild.nodevalue
    			   if indexArrayObservation<2 then
    				   indexArrayObservation=indexArrayObservation+1
    			   end if
    			end if
    		Next
    		Response.write arrObservation(1) & " - " & arrObservation(2) & "
    "
    		indexArrayObservation=0 
    	Next
    end if
    %>
    Ciao e buon lavoro.

    Senatus PopulusQue Romanus

  3. #3
    Bravissimo!!
    Grazie Kolosseo

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.