page_elements = xml_page.findall("p:Page", _ns)
// can there be multiple pages in a single XML file? -> I don"t think so
assert len(page_elements) == 1
return Page.from_xml(page_elements[0])
def save_baselines(filename, baselines, ratio=(1, 1), initial_shape=None):
txt_lines = [TextLine.from_array(baseline_coords=b, id="line_{}".format(i)) for i, b in enumerate(baselines)]
After Change
xml_page = ET.parse(filename)
page_elements = xml_page.find("p:Page", _ns)
metadata_et = xml_page.find("p:Metadata", _ns)
page = Page.from_xml(page_elements)
page.metadata = Metadata.from_xml(metadata_et)
return page
def save_baselines(filename, baselines, ratio=(1, 1), initial_shape=None):
txt_lines = [TextLine.from_array(baseline_coords=b, id="line_{}".format(i)) for i, b in enumerate(baselines)]