Sub Process_Globals
Private sax As SaxParser
Type Record (Name As String, Rating As Int)
Private Records As List
End Sub
Sub Globals
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
Records.Initialize
sax.Initialize
Dim in As InputStream = File.OpenInput(File.DirAssets, "1.xml")
sax.Parse(in, "sax")
in.Close
Log(Records)
End If
End Sub
Sub Sax_StartElement (Uri As String, Name As String, Attributes As Attributes)
End Sub
Sub Sax_EndElement (Uri As String, Name As String, Text As StringBuilder)
If Name = "name" Then
Dim r As Record
r.Initialize
r.Name = Text.ToString.Trim
Records.Add(r)
Else if Name = "rating" Then
Dim r As Record = Records.Get(Records.Size - 1)
r.Rating = Text.ToString.Trim
End If
End Sub