New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HtmlNode.InnerText Not working properly #427
Comments
Hello @MartinHenkeQP , Due to some backward compatibility, we choose to let this work like this. Many people use the library to parse text and would have expected to get the From the past experience, we learned that this small kind of fix generally causes a lot of issues for people using our library in their production environment, so we try as much as possible to don't touch it. You can on your side fix it by simply decoding the HTML: HtmlDocument htmlDocument = new HtmlDocument();
htmlDocument.LoadHtml(@"<p id=""demo""> hello </p>");
var text = HttpUtility.HtmlDecode( htmlDocument.DocumentNode.InnerText); Best Regards, Jon Performance Libraries Runtime Evaluation |
Dear Jon,
Thanks for the info. However to simplify the process and to avoid this issue being reported again, perhaps it might be an option to provide another method, e.g. GetInnerText(), and set a comment to the InnerText property to use GetInnerText() to get the decoded text. This would not break compatibility and support developers who need the decoded text.
Best regards,
Martin
…________________________________
Von: Jonathan Magnan <notifications@github.com>
Gesendet: Montag, 8. März 2021 18:03
An: zzzprojects/html-agility-pack
Cc: Martin Henke; Mention
Betreff: Re: [zzzprojects/html-agility-pack] HtmlNode.InnerText Not working properly (#427)
Hello @MartinHenkeQP<https://github.com/MartinHenkeQP> ,
Due to some backward compatibility, we choose to let this work like this. Many people use the library to parse text and would have expected to get the and not a space (even if space is really what should have been expected).
From the past experience, we learned that this small kind of fix generally causes a lot of issues for people using our library in their production environment, so we try as much as possible to don't touch it.
You can on your side fix it by simply decoding the HTML:
HtmlDocument htmlDocument = new HtmlDocument();
htmlDocument.LoadHtml(@"<p id=""demo""> hello </p>");
var text = HttpUtility.HtmlDecode( htmlDocument.DocumentNode.InnerText);
Best Regards,
Jon
________________________________
Performance Libraries
context.BulkInsert(list, options => options.BatchSize = 1000);
Entity Framework Extensions<http://entityframework-extensions.net/> * Entity Framework Classic<http://entityframework-classic.net/> * Bulk Operations<http://bulk-operations.net/> * Dapper Plus<http://dapper-plus.net/>
Runtime Evaluation
Eval.Execute("x + y", new {x = 1, y = 2}); // return 3
C# Eval Function<http://eval-expression.net/> * SQL Eval Function<http://eval-sql.net/>
-
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#427 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AJG6P53C7GCYENIHL4BBQMTTCT7NJANCNFSM4YPECLXQ>.
|
InnerText returns
" "
1. Description
4. Any further technical details
Add any relevant detail can help us, such as:
The text was updated successfully, but these errors were encountered: