parameters: (self, element_tree, field, iteration_index=0)
docstring: Used to replace field in ODT document like checkboxes
docstring_summary: Used to replace field in ODT document like checkboxes
docstring_tokens: Used to replace field in ODT document like checkboxes
function: def _replaceNodeViaFormName(self, element_tree, field, iteration_index=0):
      """
      Used to replace field in ODT document like checkboxes
      """
      field_id = field.id
      reference_xpath = '//*[@form:name = "%s"]' % field_id
      # if form name space is not in the name space dict of element tree,
      # it means that there is no form in the tree. Then do nothing and return.
      if not 'form' in element_tree.nsmap:
        return
      reference_list = element_tree.xpath(reference_xpath, namespaces=element_tree.nsmap)
      for target_node in reference_list:
        attr_dict = {}
        attr_dict.update(target_node.attrib)
        new_node = field.render_odt(as_string=False, attr_dict=attr_dict)
        target_node.getparent().replace(target_node, new_node)
function_tokens: def _replaceNodeViaFormName ( self , element_tree , field , iteration_index = 0 ) : field_id = field . id reference_xpath = '//*[@form:name = "%s"]' % field_id # if form name space is not in the name space dict of element tree, # it means that there is no form in the tree. Then do nothing and return. if not 'form' in element_tree . nsmap : return reference_list = element_tree . xpath ( reference_xpath , namespaces = element_tree . nsmap ) for target_node in reference_list : attr_dict = { } attr_dict . update ( target_node . attrib ) new_node = field . render_odt ( as_string = False , attr_dict = attr_dict ) target_node . getparent ( ) . replace ( target_node , new_node )