Bonjour
Quelqu'un peut me traduire ça en vb.net ?
Const sFileContent As String = "1;paris;ibis" & vbNewLine & _
"2;marseille;concorde"
Private Sub Form_Load()
Dim oXML As DOMDocument
Dim oRoot As IXMLDOMElement
Dim i As Long
Dim xsHotels() As String
Dim xsParts() As String
'# L'objet qui va nous permettre de manipuler notre document.
Set oXML = New DOMDocument
'# Racine de notre document
oXML.appendChild oXML.createElement( "hotels" )
'# On découpe la chaine d'entrée par lignes : une ligne = un hotel
xsHotels = Split(sFileContent, vbNewLine)
For i = 0 To UBound (xsHotels)
'# On créé un élément 'hotel' pour chaque hotel
Set oRoot = oXML.createElement( "hotel" )
oXML.childNodes( 0 ).appendChild oRoot
'# On découpe chacun des champs qui compose chaque ligne
xsParts = Split(xsHotels(i), ";" )
'# On definit chaque attribut
oRoot.setAttribute "id" , xsParts( 0 )
oRoot.setAttribute "ville" , xsParts( 1 )
oRoot.setAttribute "nom" , xsParts( 2 )
Next i
'# On crée le fichier XML
oXML.save "C:\d.xml"
End Sub