How to convert xml to style so that browser can render html from xml when using RSS

peter liles 556 Reputation points
2023-01-30T01:05:53.09+00:00

I have downloaded a app called MessageBoard and trying to configure RSS Feed to output serialised data to browser. The result display a error message with code written in xml format.

This XML file does not appear to have any style information associated with it.

Therefore How do i setup and add such a file ?

The method


        Public Function GetLatestMessages(ByVal format As FeedFormat) As SyndicationFeedFormatter Implements IFeedService.GetLatestMessages
            Dim rootUri As Uri = GetRootUri(
                       Dim feed As SyndicationFeed = New SyndicationFeed("Message Board", "A sample message board built using Visual Studio 2008.", rootUri)

               feed.Items = From m In MessageProvider.GetRecentMessages(0, 10) Select CreateSyndicationItem(m, rootUri)
          
                   

            If format = FeedFormat.Atom Then Return New Atom10FeedFormatter(feed)
            Return New Rss20FeedFormatter(feed)
         
        End Function


        Private Function CreateSyndicationItem(ByVal m As Message, ByVal rootUri As Uri) As SyndicationItem
          
            Dim uriBuilder As UriBuilder = New UriBuilder(rootUri)
            uriBuilder.Path += "/Message.aspx"
            uriBuilder.Query = "id=" & m.topicId.ToString(CultureInfo.InvariantCulture)

      
            'The Syndic
            Dim item = New SyndicationItem(m.TopicSubject,
                                           m.TopicBody,
                                           uriBuilder.Uri,
                                           m.topicId.ToString(),
                                           New DateTimeOffset(m.topiccreateDate, New New TimeSpan(0)))
           
     
  Return item
        End Function
Developer technologies | ASP.NET | Other
{count} votes

Accepted answer
  1. https://assvhvf b Benjamin k fgvgbbcf 75 Reputation points
    2023-03-28T22:28:04.0866667+00:00
    http://www.tg.com/resolve?domain=seha_sa&post=7678
    

    Dim rssWriter As XmlWriter = XmlWriter.Create("rss.xml")

            rssWriter.WriteProcessingInstruction("xml-stylesheet",
    
                                                 "type='text/xsl' href='XSLTFile.xslt'")
    
            Dim rssFormatter As Rss20FeedFormatter = New Rss20FeedFormatter(feed)
    
            rssFormatter.WriteTo(rssWriter)
    
            rssWriter.Close()
    
            Return rssFormatter
    

    The system returns a request error message:

    The server encountered an error processing the request. The exception message is 'Access to the path 'C:\Program Files (x86)\IIS Express\rss.xml' is denied.'. See server logs for more details.

    The stack trace ends at first line shows.so i assume that the feed is readonly ?

    so how may i edit the file to write the xls sheet address and then return edited version as shown on original question.

    I wish there was a working example of rss.

    0 comments No comments

11 additional answers

Sort by: Most helpful
  1. peter liles 556 Reputation points
    2023-02-01T00:36:34.5333333+00:00

    The code block below is the experimental XML content that is produced. I eventually managed to obtain reference to XSLT file. I am not familiar with both sets of languages to create the XSLT style sheet.

    Is there a way to quickly transform from one type to another?

    
    
    

  2. peter liles 556 Reputation points
    2023-02-01T00:39:04.25+00:00
    <!--<rss xmlns:a10="http://www.w3.org/2005/Atom" version="2.0">
    	<channel>
    		<title>Message Board</title>
    		<link>http://localhost:61419/MyProject/Messaging/Forum/NEWFILES</link>
    		<description>A sample message board built using Visual Studio 2008.</description>
    		<item>
    			<guid isPermaLink="false">63</guid>
    			<link>http://localhost:61419/MyProject/Messaging/Forum/NEWFILES/Message.aspx?id=63</link>
    			<author>peter10</author>
    			<title>services</title>
    			<description>ujjll jopjo jojoj oijoij oijoijo jojoj oijoijo ojojo joi</description>
    			<a10:updated>2023-01-25T02:14:00Z</a10:updated>
    		</item>
    		<item>
    			<guid isPermaLink="false">52</guid>
    			<link>http://localhost:61419/MyProject/Messaging/Forum/NEWFILES/Message.aspx?id=52</link>
    			<author>peteradmin</author>
    			<title>products</title>
    			<description>hhhh hhhiuh hihiuhiuh ihihiuhi ihihih ihihih uhihih uihiuhiuhi ihhihih uhihihi ihihihi ihiihih ihihihihi jhhjhhj jhhjhhj jhhjhhhjjh jhhjhhjhhjh pppppp jjjjkkjkj bjhhjhjhh yyyyyyyyyj</description>
    			<a10:updated>2023-01-22T00:52:00Z</a10:updated>
    		</item>
    	</channel>
    </rss>-->
    
    0 comments No comments

  3. peter liles 556 Reputation points
    2023-02-02T01:41:47.34+00:00

    I have created a XSLT file and attempted to attach to the rss XML file as generated from my RSS method.

    using the following code:

     Dim rssWriter As XmlWriter = XmlWriter.Create("rss.xml")
                rssWriter.WriteProcessingInstruction("xml-stylesheet",
                                                     "type='text/xsl' href='XSLTFile.xslt'")
                Dim rssFormatter As Rss20FeedFormatter = New Rss20FeedFormatter(feed)
                rssFormatter.WriteTo(rssWriter)
                rssWriter.Close()
                Return rssFormatter
    
    The system returns a request error message:
    The server encountered an error processing the request. The exception message is 'Access to the path 'C:\Program Files (x86)\IIS Express\rss.xml' is denied.'. See server logs for more details.
    The stack trace ends at first line shows.so i assume that the feed is readonly ? 
    so how may i edit the file to write the xls sheet address and then return edited version as shown on original question.
    I wish there was a working example of rss.  
    
    0 comments No comments

  4. peter liles 556 Reputation points
    2023-02-02T22:55:38.47+00:00

    the system warns me that i need admin permission to change IIS Express folder access. Is this a windows login routine or sql server ?


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.