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.64k stars 375 forks source link

Immutable transformation of HTML document tree #52

Open riyadparvez opened 7 years ago

riyadparvez commented 7 years ago

Transformations list here: http://html-agility-pack.net/manipulation are not immutable transformation. It's very useful to have the original document tree intact and provide immutable transformation to return newly modified tree.

JonathanMagnan commented 7 years ago

Hello @riyadparvez ,

I will look at this, but I'm not sure if we will implement it or not this features before the V2.x

I will let you know more very soon regarding this subject probably before Monday.

Best Regards,

Jonathan

JonathanMagnan commented 7 years ago

Hello @riyadparvez ,

We do not plan in short-term to support immutable transformation however you can clone the DocumentNode and work on it. So you will still keep a reference to the original document tree.

var cloned = doc.DocumentNode.Clone();

Let me know if that answer successfully to your request.

Best Regards,

Jonathan