سلام دوستان من دارم یه برنامه خبر خوان (RSS)مینویسم به یه مشکل برخوردم یکی از تگ هایی که برام مهمه نمی خونه content:encoded هست ولی بقیه تگ ها رو میاره
Sub Process_Globals
Dim Parser As SaxParser
Dim web As PhoneIntents
Dim hc As HttpClient
Dim req As HttpRequest
Dim string1 As String
End Sub
Sub Globals
Dim RSS As ListView
Dim Title, Link, PubDate, Description As String
Dim encoded As String
Dim BufferText As String
Dim NewFeed As String
Dim lbl As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("rss")
If File.Exists(File.DirDefaultExternal, "RSS.xml") = True Then
BufferText = File.ReadString(File.DirDefaultExternal, "RSS.xml")
End If
' RSS.Width = 100%x
' RSS.Height = 100%y
Parser.Initialize
hc.Initialize("hc")
req.InitializeGet(mataleb.site)
'"http://herfeiha92.blogfa.com/rss"
hc.Execute(req, 1)
ProgressDialogShow("لطفا صبر کنید")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause(UserClosed As Boolean)
End Sub
Sub RSS_ItemClick(Position As Int, Value As Object)
string1 = Value
StartActivity("rsstext")
End Sub
Sub hc_ResponseSuccess(Response As HttpResponse, TaskId As Int)
Response.GetAsynchronously("GetRSS", File.OpenOutput(File.DirDefaultExternal, "RSS.xml", False), True, TaskId)
End Sub
Sub hc_ResponseError(Response As HttpResponse, Reason As String, StatusCode As Int, TaskId As Int)
If Response <> Null Then
Msgbox("Error: " & Response.GetString("UTF8"), "Connection Error")
Response.Release
End If
End Sub
Sub GetRSS_StreamFinish(Success As Boolean, TaskId As Int)
ProgressDialogHide
If Success = False Then
Msgbox(LastException.Message, "Error")
Return
End If
Dim In As InputStream
In = File.OpenInput(File.DirDefaultExternal, "RSS.xml")
Parser.Parse(In, "Parser")
In.Close
NewFeed = File.ReadString(File.DirDefaultExternal, "RSS.xml")
If BufferText.Length <> NewFeed.Length Then
Msgbox("There's something new", "")
End If
End Sub
Sub Parser_StartElement(Uri As String, Name As String, Attributes As Attributes)
End Sub
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
End If
Else If Name = "link" Then
Link = Text.ToString
Else
If Name = "description" Then
Description = Text.ToString
End If
End If
If Name = "content:encoded" Then [color=#ff0000][size=4]این رو نمیخونه[/size][/color][size=4][size=2][/size][/size]
encoded = Text.ToString
End If
If Name = "item" Then
RSS.AddSingleLine2(Title, encoded)
lbl = RSS.SingleLineLayout.Label
lbl.TextSize = 15
lbl.Left = lbl.width - 5dip
lbl.TextColor = Colors.White
End If
End Sub
سوال
msajad 501
سلام دوستان من دارم یه برنامه خبر خوان (RSS)مینویسم به یه مشکل برخوردم یکی از تگ هایی که برام مهمه نمی خونه content:encoded هست ولی بقیه تگ ها رو میاره
ادرسم
http://hemasenews.ir/news/rooz/feed/
اینم کدم
Sub Process_Globals Dim Parser As SaxParser Dim web As PhoneIntents Dim hc As HttpClient Dim req As HttpRequest Dim string1 As String End Sub Sub Globals Dim RSS As ListView Dim Title, Link, PubDate, Description As String Dim encoded As String Dim BufferText As String Dim NewFeed As String Dim lbl As Label End Sub Sub Activity_Create(FirstTime As Boolean) Activity.LoadLayout("rss") If File.Exists(File.DirDefaultExternal, "RSS.xml") = True Then BufferText = File.ReadString(File.DirDefaultExternal, "RSS.xml") End If ' RSS.Width = 100%x ' RSS.Height = 100%y Parser.Initialize hc.Initialize("hc") req.InitializeGet(mataleb.site) '"http://herfeiha92.blogfa.com/rss" hc.Execute(req, 1) ProgressDialogShow("لطفا صبر کنید") End Sub Sub Activity_Resume End Sub Sub Activity_Pause(UserClosed As Boolean) End Sub Sub RSS_ItemClick(Position As Int, Value As Object) string1 = Value StartActivity("rsstext") End Sub Sub hc_ResponseSuccess(Response As HttpResponse, TaskId As Int) Response.GetAsynchronously("GetRSS", File.OpenOutput(File.DirDefaultExternal, "RSS.xml", False), True, TaskId) End Sub Sub hc_ResponseError(Response As HttpResponse, Reason As String, StatusCode As Int, TaskId As Int) If Response <> Null Then Msgbox("Error: " & Response.GetString("UTF8"), "Connection Error") Response.Release End If End Sub Sub GetRSS_StreamFinish(Success As Boolean, TaskId As Int) ProgressDialogHide If Success = False Then Msgbox(LastException.Message, "Error") Return End If Dim In As InputStream In = File.OpenInput(File.DirDefaultExternal, "RSS.xml") Parser.Parse(In, "Parser") In.Close NewFeed = File.ReadString(File.DirDefaultExternal, "RSS.xml") If BufferText.Length <> NewFeed.Length Then Msgbox("There's something new", "") End If End Sub Sub Parser_StartElement(Uri As String, Name As String, Attributes As Attributes) End Sub 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 End If Else If Name = "link" Then Link = Text.ToString Else If Name = "description" Then Description = Text.ToString End If End If If Name = "content:encoded" Then [color=#ff0000][size=4]این رو نمیخونه[/size][/color][size=4][size=2][/size][/size] encoded = Text.ToString End If If Name = "item" Then RSS.AddSingleLine2(Title, encoded) lbl = RSS.SingleLineLayout.Label lbl.TextSize = 15 lbl.Left = lbl.width - 5dip lbl.TextColor = Colors.White End If End Subدلیلش چیه؟
لینک ارسال
به اشتراک گذاری در سایت های دیگر
1 پاسخ به این سوال تاکنون داده شده است
ارسالهای توصیه شده
بایگانی شده
این موضوع بایگانی و قفل شده و دیگر امکان ارسال پاسخ نیست.