[Gambas-user] xmlreader Gambas 3.10.0
Shannon Kuchler
shannon at inflecto.org
Mon Apr 2 21:52:41 CEST 2018
In this code as soon as XmlReader encounters a comment line in a xml file
it goes to end of file and stops the loop
any ideas why?
-----------------------------------------------------------------------------------------------
Public Sub Form_Open()
Dim fileName As String
Dim getFile As String
Dim sXml As String
Dim x As Integer
Dim reader As XmlReader
reader = New XmlReader
For Each fileName In Dir(User.Home & "/" & ".mi4l/data", "*.xml", gb.File)
getFile = User.Home & "/" & ".mi4l/data" & "/" & fileName
x = 0
Try reader.Open(getFile)
If Error Then
Message.Error("Error Can't Find XML file(s) to load!")
Return
Endif
Do While True
Try reader.Read()
If reader.Eof Then Break
Select Case reader.Node.Name
Case "ServerGroup"
For Each reader.Node.Attributes
If reader.Node.Name = "Name" And x = 0 Then
ListBox5.Add(reader.Node.Value)
ListBox1.Add(getFile)
x = 1
Print "ServerGroup = " & reader.Node.Value
Endif
Next
End Select
Loop
Next
End
--------------------------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20180402/171827bc/attachment-0001.html>
More information about the User
mailing list