Problems with InputStream +Parse+httputils

invaderwt

Member
Licensed User
Longtime User
I tried this code.
I get the inputstream and tried pass by parse to list and an exception show, but if a put everything in a edit text the donwload I see the text.
How I send to parse the imputstream or I did something incorrectly ?
Thanks for the help

B4X:
'Activity module
Sub Process_Globals
   Dim Parser As SaxParser
End Sub

Sub Globals
   Dim ListView1 As ListView
   Dim EditText1 As EditText
   Dim Title,link As String
End Sub

Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("1.bal")
   Dim job1, job2, job3 As HttpJob
'   job1.Initialize("Job1", Me)
   
   'Send a GET request
'   job1.Download2("http://www.b4x.com/print.php", _
'      Array As String("first key", "first value :)", "second key", "value 2"))
   
   'Send a POST request
'   job2.Initialize("Job2", Me)
'   job2.PostString("http://www.b4x.com/print.php", "first key=first value&key2=value2")
   
   'Send a GET request
   job3.Initialize("Job3", Me)
   'job3.Download("http://www.b4x.com/forum/images/categories/android.png")
   job3.Download("http://feeds.feedburner.com/AnimeFreakShowV40Podcast")
End Sub

Sub JobDone (Job As HttpJob)
   Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
   If Job.Success = True Then
      Select Job.JobName
      '   Case "Job1", "Job2"
            'print the result to the logs
            Log(Job.GetString)
         Case "Job3"
            'show the downloaded image
            'Activity.SetBackgroundImage(Job.GetBitmap)
            EditText1.Text=(Job.GetString)
            
            addItens(Job.GetInputStream)
            
      End Select
   Else
      Log("Error: " & Job.ErrorMessage)
      ToastMessageShow("Error: " & Job.ErrorMessage, True)
   End If
   Job.Release
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


Sub addItens ( in As InputStream)
   
   
   
   ListView1.AddSingleLine("Is started: "&in.IsInitialized)
   Parser.Parse(in,"Parse")
   in.Close
End Sub

Sub Parser_EndElement (Uri As String, Name As String, Text As StringBuilder)
    
    If Parser.Parents.IndexOf("channel") > -1 Then
   
       If Name = "title" Then
           '    Title = Text.ToString
          ' Else If Name = "link" Then
         '      link = Text.ToString
        '   End If
          ListView1.AddSingleLine("Teste1")
      End If
      ListView1.AddSingleLine("Teste2")
    End If
    If Name = "channel" Then
      ListView1.AddSingleLine("Teste3")
        'ListView1.AddSingleLine2(Title, link) 'add the title as the text and the link as the value
    End If
End Sub
 

Attachments

  • 00.png
    53.3 KB · Views: 438
  • 01.png
    44.3 KB · Views: 389

invaderwt

Member
Licensed User
Longtime User
the parser.parser(in,"Parser")
How I can debbug this???
If u tell me . Possible I will know how resolve
thanks
One the xml comes must has the elemment it the first member or can be started with other thing?

it´s is possible the parser can´t resolve
B4X:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2enclosuresfull.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:rawvoice="http://www.rawvoice.com/rawvoiceRssModule/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
   <title>Anime Freak Show v4.0</title>
   
   <link>http://anfreak.com.br</link>
 
Upvote 0

invaderwt

Member
Licensed User
Longtime User
no
I inicializate now
and word
I´m an idiot
When i read I can´t belive.
I test I´m calling " I´m idiot"!

thanks
Know works every thing.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…