Extend BaseForm's helper function for outputting HTML. Used by as_table(), as_ul(), as_p().

        Combines the HTML version of the main form's fields with the HTML content
        for any subforms.

def _html_output(self, normal_row, error_row, row_ender,  help_text_html, errors_on_separate_row):
        """Extend BaseForm's helper function for outputting HTML. Used by as_table(), as_ul(), as_p().

        Combines the HTML version of the main form's fields with the HTML content
        for any subforms.
        """
        parts = []
        parts.append(super(XmlObjectForm, self)._html_output(normal_row, error_row, row_ender,
                help_text_html, errors_on_separate_row))

        def _subform_output(subform):
            return subform._html_output(normal_row, error_row, row_ender,
                                        help_text_html, errors_on_separate_row)

        for name, subform in six.iteritems(self.subforms):
            # use form label if one was set
            if hasattr(subform, 'form_label'):
                name = subform.form_label
            parts.append(self._html_subform_output(subform, name, _subform_output))

        for name, formset in six.iteritems(self.formsets):
            parts.append(u(formset.management_form))
            # use form label if one was set
            # - use declared subform label if any
            if hasattr(formset.forms[0], 'form_label') and \
                    formset.forms[0].form_label is not None:
                 name = formset.forms[0].form_label
            # fallback to generated label from field name
            elif hasattr(formset, 'form_label'):
                name = formset.form_label

            # collect the html output for all the forms in the formset
            subform_parts = list()

            for subform in formset.forms:
                subform_parts.append(self._html_subform_output(subform,
                                      gen_html=_subform_output, suppress_section=True))
            # then wrap all forms in the section container, so formset label appears once
            parts.append(self._html_subform_output(name=name, content=u'\n'.join(subform_parts)))

        return mark_safe(u'\n'.join(parts))