Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it L'avatar di Luca1317
    Registrato dal
    Dec 2001
    Messaggi
    1,258

    Ciclo For to su file xml

    Potete darmi una mano per il ciclo For .. to? mi da l'errore:
    "Errore di run-time di Microsoft VBScript (0x800A01A8)
    Necessario oggetto: 'OGGETTOA'"

    il file xml è
    codice:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <catalog>
    	<categories>
    		<category code="VT"><![CDATA[OGGETTOA]]></category>
    			<category code="VTRT"><![CDATA[OGGETTOB]]></category>
    			<category code="VFG"><![CDATA[OGGETTOT]]></category>
    			<category code="VDF"><![CDATA[OGGETTO4]]></category>
    			<category code="VSD"><![CDATA[OGGETTOE]]></category>
    ...
    ...
    Mentre il codice asp che uso è:
    codice:
    StrURL = "http://www.miosito.com/xml/file.xml"
    Set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP") 
    objXMLHTTP.Open "GET", StrURL, false 
    
    objXMLHTTP.Send 
    content = objXMLHTTP.ResponseText
    
    
    set oXmlDoc = Server.CreateObject("MSXML2.DOMDocument")
    
    'apri il file
    oXmlDoc.async = false
    oXmlDoc.loadXML (content)
    
    Dim category
    category=oXmlDoc.selectSingleNode("//categories/category").text
    response.write("Categoria=" & category & "
    ")
    
    
    ' Inizializzo il contatore per il ciclo
    i = 0
    
    ' Estraggo tutti i dati
    For i = 0 To category.length - 1
      With Response
        .Write "Nome: " & category(i).Text & "
    "
      End With
    Next

  2. #2
    la sintassi VBScript corretta è

    for i=0 to ubound(category)

    next

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 © 2025 vBulletin Solutions, Inc. All rights reserved.