zzzprojects / html-agility-pack

Html Agility Pack (HAP) is a free and open-source HTML parser written in C# to read/write DOM and supports plain XPATH or XSLT. It is a .NET code library that allows you to parse "out of the web" HTML files.
https://html-agility-pack.net
MIT License
2.65k stars 375 forks source link

Fix AOT warning with HtmlNode.GetAttributeValue #573

Closed euju-ms closed 6 days ago

euju-ms commented 2 weeks ago

T HtmlNode.GetAttributeValue<T>(string name, T def) is not AOT compatible because it calls into an extension method Utilities.To (which is also not AOT compatible).

This PR makes T HtmlNode.GetAttributeValue<T>(string name, T def) obsolete, and adds an overload for GetAttributeValue that takes in an additional parameter parser for converting the string attribute value into type T.

All the internal usages are converted to use the new API.

euju-ms commented 1 week ago

@JonathanMagnan Do you think we can proceed with this PR? I'm just trying to figure out my options :)

JonathanMagnan commented 1 week ago

Hello @euju-ms ,

Sorry, I forgot to answer.

I'm currently on vacation this week in Mexico. So, I will look at it next week when I will be back.

Best Regards,

Jon