How do you display html data tags surrounding text within a XML file

peter liles 556 Reputation points
2023-03-11T00:45:47.32+00:00

I have created a RSS Feed using xml data and converted via xslt for display in browser window.

I now insert the data for display using a ajax text editor which now injects additional style tags to the data and inserts into xml file like such.

<rss xmlns:a10="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title>Latest Submissions.</title>
    
    <item>
      <guid isPermaLink="false">2164</guid>
     
      <description>klklkl &amp;lt;span style=&amp;quot;text-decoration: underline;&amp;quot;&amp;gt;jnjnoiio&amp;lt;/span&amp;gt; noijoijoi uooijoijoijoij</description>
      <pubDate>Fri, 10 Mar 2023 23:54:00 Z</pubDate>
      <a10:updated>2023-03-10T23:54:00Z</a10:updated>
    </item>

The output is as shown similar structure in browser window containing style code. When i want the inserted tags to style the text instead.

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,248 questions
{count} votes

Accepted answer
  1. QiYou-MSFT 4,306 Reputation points Microsoft Vendor
    2023-03-17T03:41:08.49+00:00

    Hi @peter liles

    Does the xml file contain html tags and RSS above? Since RSS is also a type of xml file, you can add xslt and use XslCompiledTransform to convert it into an html file. At the same time, the above html tag files can be broken into another file by character determination and directly saved as HTML files. Finally, the two HTML files are spliced together.

    XslCompiledTransform trans = new XslCompiledTransform();
    trans.Load(@"..\..\books.xsl");
    trans.Transform(@"..\..\books.xml", "out.html");
    

    Best regards,
    Qi You


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. peter liles 556 Reputation points
    2023-03-16T14:16:32.9766667+00:00

    Originally i entered text via a textbox as plain text and inserted into database table. When retrieved from table for rss feed the generated xml is shown above in the xml file. To style xml i normally have to manual change the corresponding xslt file.

    Now i have changed the textbox into a ajax editor for data entry. The output rss file to xml now contains html tags along with the text as shown. when ideally i wanted the text to be rendered as html and style in browser window.