내 입력 내용
<table border="0" align="center" width="100%">
<tr><td class="header">A
<td class="header">B
<td class="header"><b>C</b>
</tr>
</table>
필요한 출력은 다음과 같습니다.
<table border="0" align="center" width="100%">
<tr><td class="header">A</td>
<td class="header">B</td>
<td class="header"><b>C</b></td>
</tr>
</table>
나는 다음의 참조를 시도했다.
HTMLAgilityPack으로 HTML 태그 (<open> 및 <close> 태그가 누락 됨)를 수정하는 방법
출력 내가있어
<table border="0" align="center" width="100%">
<tr><td class="header"></td>A
<td class="header"></td>B
<td class="header"></td><b>C</b>
</tr>
</table>
나는이 HTML 파일에 익숙하지 않다.
미리 감사드립니다 ..
Html 민첩성 팩에는 HtmlDocument
클래스의 속성으로 사용할 수있는 특별한 옵션이 있는데,이 종류의 HTML 오류를 수정하기위한 OptionFixNestedTags
가 있습니다.
static void Main(string[] args)
{
HtmlDocument doc = new HtmlDocument();
doc.OptionFixNestedTags = true;
doc.Load(YourFile);
doc.Save(Console.Out);
}
그러면 다음과 같이 출력됩니다.
<table border="0" align="center" width="100%">
<tr><td class="header">A
</td><td class="header">B
</td><td class="header"><b>C</b>
</td></tr>
</table>