Mike,
I guess the main reason is that traversing the dom tree becomes difficult if the structure can change while traversing it. For instance: if the visitor adds new elements, it's possible the accept() method won't be called on these new elements (it will depend on the implementation of the accept method). Or if the visitor moves an element to another place in the same document it's again possible that the accept() method will never get called etc etc. If you have any suggestions about how these traversing problems could be solved for mutable structures, please share them with us :)
regards, Maarten
Mike Skells wrote:
Hi,
There seems to be an assumption that a visitor cannot modify the structure built into the code into AbstractElement.accept(Visitor)
the length of the attributes and the content is cached so that if the visitor modifies the content then NPE can occur, or nodes can be missed
Is there something in the visitor pattern that means that the visitor cannot make changes (None that I am aware of)
------------------------------------------------------- This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND _______________________________________________ dom4j-dev mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-dev