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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
| Dim Name2 As String = "Page_Zone"
Dim element As XmlNodeList
Dim XmlDoc As XmlDocument = New XmlDocument()
XmlDoc.Load(My.Application.Info.DirectoryPath & "\Réf Zone.xml")
element = XmlDoc.DocumentElement.GetElementsByTagName("Zone")
For Each noeud In element
'For Each noeudEnf In noeud.ChildNodes
' If noeudEnf.LocalName = "Nombre_de_pages_Zone" Then
' 'Name = noeudEnf.InnerText
' Name = noeudEnf.LocalName
' End If
' If Name = Name2 Then
' Console.WriteLine("Trouvé ..... " & Name)
' 'XmlDoc.DocumentElement.RemoveChild(noeudEnf)
' End If
'Next
Next
'Try
' 'charge le fichier xml
' Dim doc As New XmlDocument
' doc.Load(My.Application.Info.DirectoryPath & "\Réf Zone.xml")
' 'selectionne le noeud parent de l'élément à supprimer
' Dim root As XmlNode = doc.SelectSingleNode("/lstSite")
' 'doc.SelectSingleNode("/lstSite")
' 'selectionne l'élément à supprimer
' Dim elem As XmlElement = doc.SelectNodes("lstSite" & "/Page_Zone").ItemOf(1 - 1)
' 'supprime l'élément
' root.RemoveChild(elem)
' 'sauvegarde
' doc.Save(My.Application.Info.DirectoryPath & "\Réf Zone.xml")
'Catch ex As Exception
' MsgBox("Erreur dans la suppression de l'élément : " & ex.Message)
'End Try
'Dim doc As New Xml.XmlDocument
'doc.Load(My.Application.Info.DirectoryPath & "\Réf Zone.xml")
''doc.LoadXml(My.Application.Info.DirectoryPath & "\Réf Zone.xml")
'Dim clientNodes = doc.SelectNodes("Page_Zone")
'For Each elem As Xml.XmlElement In clientNodes
' If elem.InnerText = Name2 Then
' Console.WriteLine("Trouvé ..... " & elem.InnerText)
' 'elem.ParentNode.RemoveChild(elem)
' Exit For
' End If
'Next
'MessageBox.Show(doc.OuterXml) |
Partager