library AngleSharp.HtmlParser in c# inserts empty spans
input html:
<div style="font-size: 16pt; font-weight: bold;">Заголовок</div>
<div>
<table style="font-family: Calibri; color: #646c71; font-size: 12pt;">
<tr><td style="width: 25%;">Строка 1:</td><td style="width: 75%;"><span class="simple-text">root</span></td></tr>
<tr><td style="width: 25%;">СТрока 2:</td><td style="width: 75%;"><span class="simple-text">08.05.2023 15:23:30</span></td></tr>
<span class="simple-text"><tr><td style="width: 25%;">Строка 3:</td><td style="width: 75%;">08.05.2023 15:23:46</td></tr></span>
<span class="simple-text"><tr><td style="width: 25%;">Строка 4:</td><td style="width: 75%;">fp</td></tr></span>
</table>
</div>
html document result after execute ParseDocument() method:
<div style="font-size: 16pt; font-weight: bold;">Заголовок</div>
<div>
<span class="simple-text"></span><span class="simple-text"></span><table style="font-family: Calibri; color: #646c71; font-size: 12pt;">
<tbody><tr><td style="width: 25%;">Строка1:</td><td style="width: 75%;"><span class="simple-text">root</span></td></tr>
<tr><td style="width: 25%;">Строка 2:</td><td style="width: 75%;"><span class="simple-text">08.05.2023 15:23:30</span></td></tr>
<tr><td style="width: 25%;">Строка 3:</td><td style="width: 75%;">08.05.2023 15:23:46</td></tr>
<tr><td style="width: 25%;">Строка 4:</td><td style="width: 75%;">fp</td></tr>
</tbody></table>
This is exactly as it should be (compare in your browser).
Reason: You place
spanelements in thetbody. Onlytrelements (and text nodes containing whitespace characters) are expected in there.This is what I get in Firefox when I paste your HTML code:
So everything is as it should be - these spans are not "inserted" they are rather moved to an appropriate position.