Imports System.Xml Module XML Public tableau() As String Private root As XmlNode Public Function openXML(ByVal fichier As String) Dim XMLStruct As New XmlDocument XMLStruct.Load(fichier) root = XMLStruct.DocumentElement End Function Public Function lectureXML(ByVal valeur As String) As String Dim temp As String Dim position As Integer temp = root.Item(valeur).InnerText position = InStr(temp, vbCr) If position <> 0 Then Return (Mid(temp, 1, position - 1)) Else Return (temp) End If End Function Public Function lectureXML(ByVal parent() As String, ByVal valeur As String) As String Dim i As Integer Dim temp As String Dim position As Integer Dim xmlTemp As XmlNode xmlTemp = root.Item(parent(0)) If isOpenXML(xmlTemp) Then For i = 1 To UBound(parent) xmlTemp = xmlTemp.Item(parent(i)) Next i temp = xmlTemp.Item(valeur).InnerText position = InStr(temp, vbCr) If position <> 0 Then Return (Mid(temp, 1, position - 1)) Else Return (temp) End If End If End Function Public Function isOpenXML(ByVal xmlTemp As XmlNode) As Boolean Dim temp As String Try temp = xmlTemp.InnerText Return True Catch Return False End Try End Function End Module
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPrivate Sub Form_Load() Dim XMl As New DOMDocument30 XMl.Load "C:\a.xml" Dim Node As IXMLDOMNode For Each Node In XMl.selectNodes("PlanInfo/Zone").Item(0).childNodes If Node.nodeName Like "Point*" Then List1.AddItem "lat. " & Node.childNodes(0).Text & " - " & "lon. " & Node.childNodes(1).Text End If Next Node End Sub