def build_non_reg_text(reg_xml, reg_part): """ This builds the tree for the non-regulation text such as Appendices and the Supplement section """ if isinstance(reg_xml, str) or isinstance(reg_xml, unicode): doc_root = etree.fromstring(reg_xml) else: doc_root = reg_xml non_reg_sects = doc_root.xpath('//PART//APPENDIX') children = [] for non_reg_sect in non_reg_sects: section_title = get_app_title(non_reg_sect) if 'Supplement' in section_title and 'Part' in section_title: children.append(build_supplement_tree(reg_part, non_reg_sect)) else: children.append(process_appendix(non_reg_sect, reg_part)) return children
def build_non_reg_text(reg_xml, reg_part): """ This builds the tree for the non-regulation text such as Appendices and the Supplement section """ if isinstance(reg_xml, six.string_types): doc_root = etree.fromstring(reg_xml) else: doc_root = reg_xml non_reg_sects = doc_root.xpath('//PART//APPENDIX') logger.debug("Non Reg sections: %r", non_reg_sects) children = [] for non_reg_sect in non_reg_sects: section_title = get_app_title(non_reg_sect) logger.debug("Building non reg sect: %s", section_title) if 'Supplement' in section_title and 'Part' in section_title: children.append(build_supplement_tree(reg_part, non_reg_sect)) else: children.append(process_appendix(non_reg_sect, reg_part)) return children