Sub Process_Globals
Type Comp (Name As String, Rating As Int)
Private Comps As List
Private parser As SaxParser
End Sub
Sub Globals
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
Comps.Initialize
parser.Initialize
Dim in As InputStream = File.OpenInput(File.DirAssets, "1.txt")
parser.Parse(in, "parser")
in.Close
Comps.SortType("Rating", True)
Log(Comps)
End If
End Sub
Sub Parser_StartElement (Uri As String, Name As String, Attributes As Attributes)
If Name = "comp" Then
Dim c As Comp
c.Initialize
c.Name = Attributes.GetValue2("", "nam")
Comps.Add(c)
End If
End Sub
Sub Parser_EndElement (Uri As String, Name As String, Text As StringBuilder)
If Name = "rating" Then
Dim c As Comp = Comps.Get(Comps.Size - 1)
c.Rating = Text.ToString
End If
End Sub