#NEWLINE# def complete_xml_element( self , xmlnode , doc ) : #NEWLINE# #INDENT# 'Complete the XML node with `self` content.\n\n        :Parameters:\n            - `xmlnode`: XML node with the element being built. It has already\n              right name and namespace, but no attributes or content.\n            - `doc`: document to which the element belongs.\n        :Types:\n            - `xmlnode`: `libxml2.xmlNode`\n            - `doc`: `libxml2.xmlDoc`' #NEWLINE# if ( self . type not in self . allowed_types ) : #NEWLINE# #INDENT# raise ValueError ( ( 'Form type %r not allowed.' % ( self . type , ) ) ) #NEWLINE# #UNINDENT# xmlnode . setProp ( 'type' , self . type ) #NEWLINE# if ( self . type == 'cancel' ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# ns = xmlnode . ns ( ) #NEWLINE# if ( self . title is not None ) : #NEWLINE# #INDENT# xmlnode . newTextChild ( ns , 'title' , to_utf8 ( self . title ) ) #NEWLINE# #UNINDENT# if ( self . instructions is not None ) : #NEWLINE# #INDENT# xmlnode . newTextChild ( ns , 'instructions' , to_utf8 ( self . instructions ) ) #NEWLINE# #UNINDENT# for field in self . fields : #NEWLINE# #INDENT# field . as_xml ( xmlnode , doc ) #NEWLINE# #UNINDENT# if ( self . type != 'result' ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# if self . reported_fields : #NEWLINE# #INDENT# reported = xmlnode . newChild ( ns , 'reported' , None ) #NEWLINE# for field in self . reported_fields : #NEWLINE# #INDENT# field . as_xml ( reported , doc ) #NEWLINE# #UNINDENT# #UNINDENT# for item in self . items : #NEWLINE# #INDENT# item . as_xml ( xmlnode , doc )