This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
My guess: to avoid an infinate loop. insertNode() calls setParent(). If setParent() called insertNode(), chaos ensues.
Joined: Sep 29, 2004
it is possible to add child to children directly. Then there will not be a loop.
Joined: Aug 07, 2003
True, but then it has to pick where to insert it (top or bottom). But that just seems like a bug waiting to happen. The bottom line seems to be that you shouldn't call setParent() yourself; problem solved.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com