Next / Previous / Contents / Shipman's homepage

28.7. EqBind.writeXML()

nomcompile3
# - - -   E q B i n d . w r i t e X M L

    def writeXML ( self, parent ):
        '''Generate XML for equivalence codes.
        '''

This method assumes that the .eng() and .lookup() methods return values other than None. The former method returns the English name on which this code is based; the latter returns a taxon, from which we extract the scientific name.

nomcompile3
        #-- 1 --
        # [ eng  :=  English name for self
        #   taxon  :=  taxon for self ]
        eng = self.eng()
        taxon = self.lookup()

The new abbr element added has code and sci attributes; its text content is the English name.

nomcompile3
        #-- 2 --
        # [ parent  :=  parent with a new rnc.ABBR_N element added
        #       whose rnc.CODE_A attribute is self.abbr, stripped;
        #       whose rnc.SCI_A attribute is taxon.sci; and whose
        #       text content is (eng) ]
        parent.append (
            E ( rnc.ABBR_N,
                { rnc.CODE_A: self.abbr.rstrip(),
                  rnc.SCI_A: taxon.sci },
                eng ) )