From: <bc...@wo...> - 2001-09-05 19:39:39
|
[Ted Berg] >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. It seems right to me. Did you expect it to write >[nodehandler, group_atts, nodehandler, file, nodehandler, file, nodehandler, file] instead? Then try to add nodes to the the list at the position where you have your print statement. >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. Posting an url to the source is the way to go. regards, finn |