This question is locked. New answers and comments are not allowed.
Hi to all
I am having a problem of loading data from the database back into the form.
I am getting "System.OutOfMemoryException" exeption.
The exception occurs while i am decoding the html.
In the file StringExtensions.cs, class "StringExtensions" we have the methode called "public static string IndentTags(this string html)".
In the lines:
I can see that the code doesn't go out of the loop, therefore i am getting "OutOfMemoryException" exception.
you can test it yourself with the next html code:
Probably this html was generated in word document, Is there a way to clean HTML code that users pasted from word document ?
can i ask, why the WRAP_THRESHOLD is set to 120 ?
I can add an if statement that checks the "splitPoint" if its 0 the we need to brake the loop, or something like that.
Any advice will be appreciated
Thank you
Ori
I am having a problem of loading data from the database back into the form.
I am getting "System.OutOfMemoryException" exeption.
The exception occurs while i am decoding the html.
var htmlContent = HttpUtility.HtmlDecode(content.Text);content.Text = htmlContent.IndentHtml();In the file StringExtensions.cs, class "StringExtensions" we have the methode called "public static string IndentTags(this string html)".
In the lines:
while (token.Length > WRAP_THRESHOLD) { int splitPoint = token.Substring(0, WRAP_THRESHOLD).LastIndexOf(' '); result.Append(token.Substring(0, splitPoint)).Append(newLine.PadRight(newLineLength + indentSize * (indentLevel + 1))); token = token.Substring(splitPoint);}you can test it yourself with the next html code:
<p dir="RTL" style="margin-top:0cm;margin-right:4.2pt;margin-bottom:3.75pt;margin-left:0cm;text-align:justify;line-height:13.5pt;direction:rtl;unicode-bidi:embed;"><span lang="nl" style="font-family:"Tahoma","sans-serif";color:black;">gazProbably this html was generated in word document, Is there a way to clean HTML code that users pasted from word document ?
can i ask, why the WRAP_THRESHOLD is set to 120 ?
private const int WRAP_THRESHOLD = 120;I can add an if statement that checks the "splitPoint" if its 0 the we need to brake the loop, or something like that.
Any advice will be appreciated
Thank you
Ori