19/09/2023 - SirJo ha scritto:
Prova questo:
        Dim docXML As New XmlDocument
        docXML.Load(filePath)
        Dim books = docXML.SelectNodes("Biblioteca/book")
        For Each book As XmlNode In books
            Dim attributes = book.Attributes
            Dim testo = "Attributi:" & vbCrLf
            For Each attribute As XmlAttribute In attributes
                testo &= attribute.Name & "='" & attribute.Value & "'" & vbCrLf
            Next
            MsgBox(testo)
        Next
Grazie, sto provando da qualche giorno a far incastrare il codice che mi hai inviato al mio ma non riesco… mi spiego meglio: il file XML era solo un esempio, e possono essere diversi tipi, ovvero non so il nome root nè i nomi dei nodi, quindi impostare "Dim books = docXML.SelectNodes("Biblioteca/book")" è impossibile…
ho provato a documentarmi se esiste una qualche funzione che mi restituisce un percorso (tipo quelli dei files) di un determinato punto per poi “buttarlo” nel docXML.SelectNodes ma non ho trovato nulla….mi spiego meglio tipo:
While Reader.Read()
       link = 'percorso_attuale_di_Reader.Read()
       
       Dim books = docXML.SelectNodes(link)
        For Each book As XmlNode In books
            Dim attributes = book.Attributes
            Dim testo = "Attributi:" & vbCrLf
            For Each attribute As XmlAttribute In attributes
                testo &= attribute.Name & "='" & attribute.Value & "'" & vbCrLf
            Next
            MsgBox(testo)
        Next
       
   End While