Salve a tutti,
ho un problema a leggere dei dati su un file XML tramite ASP.
Il file xml ha la seguente struttura:
<archivio>
<user id="1">
<username>Mario</username>
<role>Admin</role>
<images>
<image>
<th>image11_th.jpg</th>
<big>image11.jpg</big>
</image>
<image>
<th>image12_th.jpg</th>
<big>image12.jpg</big>
</image>
<image>
<th>image13_th.jpg</th>
<big>image13.jpg</big>
</image>
<images>
<user>
<user id="2">
<username>Giuseppe</username>
<role>User</role>
<images>
<image>
<th>image21_th.jpg</th>
<big>image21.jpg</big>
</image>
<image>
<th>image22_th.jpg</th>
<big>image22.jpg</big>
</image>
<images>
<user>
</archivio>
Avrei bisogno di leggere i dati nel formato:
Id, Username, Ruolo, Image/th, Image/th, Image/th
Quindi nel caso di esempio dovrei avere:
1, Mario, Admin, image11_th.jpg, image12_th.jpg, image13_th.jpg
2, Giuseppe, User, image21_th.jpg, image22_th.jpg
Ho realizzato un ciclo per leggere il file ma non riesco a leggere l'id e le immagini
-----------
set ElemProperty = objxml.getElementsByTagName("archivio/user")
set ImagesProperty = objxml.getElementsByTagName(archivio/user/images")
set ImageName = objxml.getElementsByTagName("archivio/user/images/image/th")
For i=0 To (ElemProperty.length -1)
For n=0 To (ImagesProperty.length -1)
Response.Write(ImageName.item(n).Text)
Next
Next
-----------
Ovviamente il codice qui sopra scrive a video sempre le immagini del primo utente, come è possibile ottentere le immagini di ogni singlo utente?
Per capirci del codice tipo:
Response.Write(ImageName(i).item(n).Text)
che ovviamente è errato
Grazie in anticipo![]()