def main():
    tree = ElementTree.parse("xml/liefde-tsa.xml")
    root = tree.getroot()
    sentence = root.xpath(".//s[@n='B917_2bis_B5_tsA_Liefde,[003]']")
    visitor = XMLElementVisitor()
    traverser = XMLElementTraverser(visitor)
    traverser.traverse(sentence)
Esempio n. 2
0
def collate_groundlayer(input_file, output_file):
    parser = ElementTree.XMLParser(remove_comments=True, remove_blank_text=True)
    tree = ElementTree.parse(input_file, parser)
    root = tree.getroot()
#   selected_text = root.xpath("./text//%s" % collation_input)
    text_file = open(output_file, 'w')
    visitor = XMLElementVisitor(text_file)
    traverser = XMLElementTraverser(visitor)
    traverser.traverse(root)
    text_file.close()