Giter Site home page Giter Site logo

Comments (2)

JonathanMagnan avatar JonathanMagnan commented on May 27, 2024

Hello @enkelmedia ,

Thank you for the project. My developer will look at it.

Best Regards,

Jon


Sponsorship
Help us improve this library

Performance Libraries
context.BulkInsert(list, options => options.BatchSize = 1000);
Entity Framework ExtensionsDapper Plus

Runtime Evaluation
Eval.Execute("x + y", new {x = 1, y = 2}); // return 3
C# Eval Function

from html-agility-pack.

JonathanMagnan avatar JonathanMagnan commented on May 27, 2024

Hello @enkelmedia ,

A custom exception pointing to this issue has been added in the v1.11.53

The issue was caused because the ChildNodes of a Child contained the same list of ChildNodes as his parent, which led to a stack overflow exception. See this part:

public void SetChildNodesId(HtmlNode chilNode)
{
foreach (HtmlNode child in chilNode.ChildNodes)
{
_ownerdocument.SetIdForNode(child, child.GetId());
if (child.ChildNodes == chilNode.ChildNodes)
{
throw new Exception("Oops! a scenario that will cause a Stack Overflow has been found. See the following issue for an example: https://github.com/zzzprojects/html-agility-pack/issues/513");
}
SetChildNodesId(child);
}
}

Another way to make it work is to clone the current node that you want to replace and use it:

if (tables != null && tables.Any())
{
	foreach (var table in tables)
	{
		var nestedTable = table.Clone();

		// Wrap the table in a div "table-wrapper" so that we can apply "mobile table"-css.
		var wrapperDivNode = HtmlNode.CreateNode("<div class=\"table-wrapper\"></div>");

		wrapperDivNode.ChildNodes.Add(nestedTable);

		table.ParentNode.ReplaceChild(wrapperDivNode, table);
	}
}

Let me know if everything is fine for you or there is something else related to this issue.

Best Regards,

Jon


Are you finding this library useful? If so, please consider supporting its continued development by becoming a sponsor.

Additionally, if you think your enterprise would benefit from this library, we encourage you to suggest they become a sponsor as well. Your support will help ensure this library remains alive and well-supported.

from html-agility-pack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.