enter code here
テストページを開こうとするとxelementで問題が発生しますが、未処理の例外が表示されます。
タグが別の行のクロージングと一致しませんクロージングタグを追加しようとしましたが、追加機能が機能する前にエラーが発生します
テストページhttp://densetsu.org/PP2012/benchmark1.html
タグの効果を失うことなくタグの問題を渡す方法はありますか?
これがメインコードです:
XElement tree = XElement.Load(toolStripTextBox1.Text);
String s = tree.ToString();
textBox1.Text = String_dealer.addmissing(s);
これはストリングチェンジャーです
public static String addmissing(String txt)
{
if (txt.Contains("<br>") || (txt.Contains("</br>")))
{
txt.Replace("<br>", "<br></br>");
txt.Replace("</br>", "<br></br>");
}
else if (txt.Contains("<hr>") || (txt.Contains("</hr>")))
{
txt.Replace("<hr>", "<hr> </hr>");
txt.Replace("</hr>", "<hr> </hr>");
}
return txt;
}
および問題のテキスト:System.Xml.dllでタイプ'System.Xml.XmlException'の未処理の例外が発生しました
追加情報:8行目の「hr」開始タグが「br」の終了タグと一致しません。行9、位置10。