Android Question [SOLVED] Stop parse big xml data

rosippc64a

Active Member
Licensed User
Longtime User
Hi All!
if you want to stop parsing big xml data, do this:
B4X:
    'rssParseStream, rssParseExit, rssItems are global variable
    rssParseStream = File.OpenInput(File.DirDefaultExternal, "RSS.xml")
    Try
        rssParseExit = False
        rssItems = 0
        ParseR.Parse(rssParseStream, "Parser")
    Catch
        If rssParseExit = False Then
            Log("Parserss error: " & LastException.Message)
            CallSubDelayed2(Main, "RSS_onError","RSS hiba: " & LastException.Message )
        else
            'stream.closed exception - I did :-)
        End If
   End Try
...

Sub Parser_StartElement(Uri As String, Name As String, Attributes As Attributes)
  ....

   If rssItems> 100 Then
       rssParseExit = True
       rssParseStream.Close
   end if
   rssItems = rssItems + 1
   ...
End sub
.
 
Last edited:
Top