Next / Previous / Contents / Shipman's homepage

29.7. CollBind.writeXML()

nomcompile3
# - - -   C o l l B i n d . w r i t e X M L

    def writeXML ( self, parent ):
        '''Build the XML for this collision set
        '''

The collision node carries the collision code as a badAbbr attribute. For each preferred code, a goodAbbr element is added whose text content is the preferred code.

nomcompile3
        #-- 1 --
        # [ parent  :=  parent with a new rnc.COLLISION_N element
        #       added whose rnc.BAD_ABBR_A attribute is self.abbr
        #   node  :=  that new element ]
        node = E ( rnc.COLLISION_N,
                   { rnc.BAD_ABBR_A: self.abbr } )
        parent.append ( node )

        #-- 2 --
        # [ node  :=  node with one rnc.GOOD_ABBR_N element added
        #       containing each element in self.collSet, in ascending
        #       order ]
        for goodCode in sorted ( self.collSet ):
            node.append ( E ( rnc.GOOD_ABBR_N, goodCode ) )