OuterLength is incorrect, refering to the reconstructed OuterHtml and not the original
In this sample HTML:
<html>
<body>
<div class='aaa' /><div class='bbb'>
</div>
</body>
</html>
When I examine the node of div with class 'aaa' the OuterHtml is <div class='aaa'></div> as it's reconstructed. The OuterLength is therefore the outer length of the OuterHtml propery (23), and not the original outer length (19). The original is stored in the _outerlength private property.
I need access to the original outer length or be able to get the original OuterHtml to get the length from there.
Hello @sperlis,
I tested and can confirm everything you mentioned.
This week, I’ll look into adding a new property, something like OriginalOuterLength, that will return the _outerlength.
Best Regards,
Jon
Thank you, this is much appreciated!
Shahar
If you're already looking at this, I have another interesting (I think) case. If you have bad HTML
<p>Text:
<div>more text</div>
</p>
Since this is illegal, the first <p> is auto-closed with synthetic "bad" HtmlNode. Which is fine. What goes wrong is the outer length. OuterLength is 10 (correct), but _outerlength and _innerlength are wrong negative numbers (I've seen -1 and -4, not sure what's the significance).
If you're already poking around in there, it might be another thing to look at :)
Thanks again!
Hello @sperlis ,
We added a new property OriginalOuterLength that should be released soon.
As for the second issue, unfortunately we didn't succeed to fix it. We indeed know exactly where it the code that happens but fixing it currently involved some major change and to be honest, we don't have enough unit test to know exactly which side impact will happens.
Best Regards,
Jon
Hello @sperlis ,
The new property has been added in the latest version: https://github.com/zzzprojects/html-agility-pack/releases/tag/v1.12.4
Thank you again for your suggestion.
Best Regards,
Jon
Thank you! appreciate your response.
If you do get around to examine the second issue it would be nice to have, but I understand it can be sensitive.
Thanks again, Shahar