Sub Process_Globals
Type Day(name As String, Activities As List)
Type Act(name As String, timeFrom As String, timeTo As String)
Dim parser As SaxParser
Dim MyDays As List
Dim tempDay As Day
Dim tempAct As Act
End Sub
Sub Globals
End Sub
Sub Activity_Create(FirstTime As Boolean)
parser.Initialize
MyDays.Initialize
Dim in As InputStream
in = File.OpenInput(File.DirAssets, "1.xml")
parser.Parse(in, "parser")
in.Close
Log(MyDays)
End Sub
Sub Parser_StartElement (Uri As String, Name As String, Attributes As Attributes)
If Name = "day" Then
Dim tempDay As Day 'this creates a new Day object
tempDay.Initialize
tempDay.Activities.Initialize
MyDays.Add(tempDay)
Else If Name = "activity" Then
Dim tempAct As Act
tempDay.Activities.Add(tempAct)
End If
End Sub
Sub Parser_EndElement (Uri As String, Name As String, Text As StringBuilder)
Select Name
Case "name"
If parser.Parents.IndexOf("activity") = -1 Then
'this is the day name
tempDay.name = Text.ToString
Else
tempAct.name = Text.ToString
End If
Case "timeFrom"
tempAct.timeFrom = Text.ToString
'complete other attributes
End Select
End Sub