[Zope] ParsedXML tree-widget

Dennis Allison allison@sumeru.stanford.EDU
Thu, 18 Apr 2002 18:48:46 -0700 (PDT)


I now have gotten a version of tpValues that seems to do the job and
allows display of the DOM in tree form without the noise of the inserted 
DOM nodes -- necessary if the display is to make sense from the XML
source.

The fix was to simply detect node types with special names (I did not
match against the legal ones, only against the leading character ('#'), 
so this is a quick workaround not a solution.

The problem I have is that to get it all to work I needed to do it by
brain surgery, actually modify the Product sources.  None of the usual
mechanisms has the right namespaces, or so it appears.  This has the 
disadvantage that it effects everything that uses the tree widget 
on the DOM, including the management screens.  I've not checked yet as
to what I did there.  :-|

The change is pretty simple -- in ManageableDOM.py:


    def tpValues(self):
        """Return a list of immediate subobjects. 
           Used by the dtml-tree tag.
           If it's a system inserted tag (e.g., #<something> ) just
           add the children in instead.  This should always be
           unary..   -dra
        """
        retList = [] # dtml-tree wants to own this
        for i in self.childNodes:
            if( i.nodeName[0] == '#'):
                kids= i.childNodes
                for k in kids:  retList.append(k)
            else:
                retList.append(i)
        return retList