I need to show character data in HTML files. It works fine when data is simple, but problem arises when data is similar to tags.
Let me describe my problem.
I am showing data coming from database tables to HTML files (I am creating table to show data).
Now if content in my table is like <img src ="445521.jpg">
it gives me error while parsing.
since it would try to search image in my system.
In XML, we have <![CDATA["content"]]>
to rescue, but I dont know what to in HTML for this,
More over I am converting this HTML to PDF. It gives me error even converting to PDF.
Can anybody tell how to create html to make parser understand that the content is Character data ?
Thanks in anticipation.
Try HttpUtility.HtmlEncode
(you'll have to import System.Web
). This will convert the special characters to HTML entities (e.g. <
→ <
).