1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
Imports System
Imports System.Xml
Imports System.Xml.XPath
Module Module1
Sub Main()
'Variables
Dim tableauValeurs() As String = {"uneImageCarte.png", "42,00", "c'est un très produit", "uneImage.jpg", "Willy-Waller 2006", "ww06/5000 pièce", "Pepsico"}
Dim i As Integer = 0
'Création du lecteur XML avec chemin relatif
Dim xmlReader As New XmlTextReader("..\..\..\bloc_gabarit.idms")
'Création du document XML
Dim xmlDoc As New XmlDocument()
'Lecture du fichier
xmlDoc.Load(xmlReader)
'Création d'un noeud et intialisation au noeud racine du document
Dim xmlNode As XmlNode = xmlDoc.DocumentElement
'Définition d'une liste de noeuds correspondant à un paramètre XPath
Dim contents As XmlNodeList = xmlNode.SelectNodes(".//Content")
'Affichage du contenu de chaque noeud
For Each content As XmlNode In contents
Console.WriteLine(content.InnerText)
content.InnerText = tableauValeurs(i)
i = i + 1
Next
xmlDoc.Save("..\..\..\bloc_gabarit_modif.idms")
Console.ReadLine()
End Sub
End Module |
Partager