Just a single accented letter to crash the control XmlSax. If you replace the line <title> Phone library was updated - V1.10 </ title> with the line <title> Phone library was updated - V1.10à </ title> procedure returns error
Sub Parser_EndElement (Uri As String, Name As String, Text As StringBuilder)
If parser.Parents.IndexOf ("item")> -1 Then
If Name = "title" Then
Title = Text.ToString
Else if name = "link" Then
Link Text.ToString
Else If Name = "pubDate" Then
pubDate = Text.ToString
end If
end If
If Name = "item" Then
ListView1.AddSingleLine2 (Title, Link) 'add the title as the text and the link as the value
end If
As this file is not encoded in the default encoding (UTF8). You should use a TextReader and specify its encoding:
B4X:
'parse the xml file
Dim in As InputStream
in = File.OpenInput(File.DirAssets, "rss.xml")
Dim tr As TextReader
tr.Initialize2(in, "ISO-8859-1")
parser.Parse2(tr, "Parser")
in.Close
I simply replaced in XmlSax.zip on the forum, with the lines:
'parse the xml file
'Dim in As InputStream
'in = File.OpenInput(File.DirAssets, "rss.xml")
'parser.Parse(in, "Parser")
'in.Close
'parse the xml file
Dim in As InputStream
in = File.OpenInput(File.DirAssets, "rss.xml")
Dim readXml As TextReader
readXml.Initialize2(in, "ISO-8859-1")
parser.Parse2(readXml, "Parser")
in.Close
If there are 12 rows in the listview (item) and can make sure that if I click on one that is highlighted. I tried ListView1.SingleLineLayout.Label.Enabled = false but is still selected. I would like clicking on a line that is evident only if Position is with an even number