Next / Previous / Contents / Shipman's homepage

19.9. Taxon.writeXML(): Recursive XML tree writer

nomcompile3
# - - -   T a x o n . w r i t e X M L

    def writeXML ( self, parent ):
        '''Generate a subtree of the taxonomy.
        '''

The XML element for the current taxon is added by Section 19.10, “Taxon.__writeXMLNode(): Write one node”. The subtree under the current taxon is written by recursive calling this method on all the children of self.

nomcompile3
        #-- 1 --
        # [ parent  :=  parent with a new rnc.TAXON_N element added
        #               that represents self
        #   node  :=  that new element ]
        node = self.__writeXMLNode ( parent )

        #-- 2 --
        # [ node  :=  node with rnc.TAXON_N elements added for
        #       self's children and their descendants, in pre-order ]
        for child in self:
            child.writeXML ( node )