# - - - A b T a b . w r i t e X M L def writeXML ( self, parent ): '''Generate the XML for all codes in the symbol table. '''
The purpose of this method is to build two subtrees of the output XML: one for valid codes, and one for collision codes. We can do both in one pass through the symbol table.
#-- 1 -- # [ parent := parent with an rnc.ABBR_SET_N node and an # rnc.COLLISION_SET added # abbrSetNode := that rnc.ABBR_SET_N node # collSetNode := that rnc.COLLISION_SET_N node ] abbrSetNode = E ( rnc.ABBR_SET_N ) parent.append ( abbrSetNode ) collSetNode = E ( rnc.COLLISION_SET_N ) parent.append ( collSetNode )
The logic that generates the XML for the various bindings
is given in their
Section 27.6, “
Section 28.7, “
Section 29.7, “
CollBind.writeXML()” generates a
#-- 2 -- # [ abbrSetNode := abbrSetNode with new rnc.ABBR_N # elements added for entries in self for valid # codes # collSetNode := collSetNode with new rnc.COLLISION_N # elements added for entries in self for # collision codes ] for sym in self: if isinstance ( sym.binding, CollBind ): sym.binding.writeXML ( collSetNode ) else: sym.binding.writeXML ( abbrSetNode )