the following code sample read from Rss Xml File and write file content as html inside iframe in web page .
Imports System.Xml
Imports System.ServiceModel.Syndication
Sub Press_News_Get()
Try
Dim ARB As String = Server.MapPath("intranet/Saudi_Press_Agent.xml")
Dim reader As New XmlTextReader(ARB)
Dim feed As SyndicationFeed = SyndicationFeed.Load(reader)
For Each item As SyndicationItem In feed.Items
Dim NewTitle As String = item.Title.Text
Dim url As String = item.Links(0).Uri.ToString()
Dim lnk As New HtmlAnchor
lnk.InnerHtml = NewTitle
lnk.HRef = url
lnk.Target = "_blank"
ml.Controls.Add(New LiteralControl("<span class=""sep"">وكالة الأنباء السعودية</span>"))
ml.Controls.Add(lnk)
ml.Attributes.Add("style", "color:blue;;margin:0px;padding:0px")
ml.Controls.Add(New LiteralControl(" "))
lnk.Attributes.Add("style", "text-decoration:none;margin:0px;padding:0px")
Next
Catch ex As Exception
Response.Write(ex.Message)
End Try
End Sub
Imports System.Xml
Imports System.ServiceModel.Syndication
Sub Press_News_Get()
Try
Dim ARB As String = Server.MapPath("intranet/Saudi_Press_Agent.xml")
Dim reader As New XmlTextReader(ARB)
Dim feed As SyndicationFeed = SyndicationFeed.Load(reader)
For Each item As SyndicationItem In feed.Items
Dim NewTitle As String = item.Title.Text
Dim url As String = item.Links(0).Uri.ToString()
Dim lnk As New HtmlAnchor
lnk.InnerHtml = NewTitle
lnk.HRef = url
lnk.Target = "_blank"
ml.Controls.Add(New LiteralControl("<span class=""sep"">وكالة الأنباء السعودية</span>"))
ml.Controls.Add(lnk)
ml.Attributes.Add("style", "color:blue;;margin:0px;padding:0px")
ml.Controls.Add(New LiteralControl(" "))
lnk.Attributes.Add("style", "text-decoration:none;margin:0px;padding:0px")
Next
Catch ex As Exception
Response.Write(ex.Message)
End Try
End Sub
No comments:
Post a Comment