From: Ted B. <te...@et...> - 2001-09-02 03:25:09
|
I'm trying to build a simple XML editor targetted at a specific use. I am displaying the xml node names as elements in a JTree and have implemented a TreeModel to accomplish this. The nodes in the tree model extract relevant info from a JDOM Element object passed to their fromXML method after creation. This method populates the callee node's child list and calls each child's fromXML method. From the print out generated by the fromXML method, it appears that everything is working, but when the process is complete another print shows that something has gone dramatically wrong. print generated during population: [Element: <nodehandler/>] [Element: <group_atts/>] [Element: <nodehandler/>] [Element: <file/>] [Element: <nodehandler/>] [Element: <file/>] [Element: <nodehandler/>] [Element: <file/>] print of tree root element's 'children' list after population of the TreeModel: [group_atts, file, nodehandler, file, nodehandler, file, nodehandler] Relevant code snippet from InstallSetTreeModel: def fromXML( self, node, space='' ): print space,node self.name = node.name for n in node.children: f = InstallSetTreeModel( self ) f.fromXML( n, space+' ') self.children.append( f ) Obviously *something* isn't right. What am I doing wrong? node is a JDOM Element object, node.children returns a List of child Elements. Once this model is placed in a tree, each node in the tree has for children each node in the tree. It's a *huge* circular reference bug, and I haven't been able to find it. The code is part of a project that will allow java/jython applications to download updates from a website. The whole shebang will be publicly available when i'm done too, if that's any sort of carrot. :) I can post the whole file if it would help, I just wanted to avoid spamming the list right off. ted |