I have large xml file and I need to split into smaller size when the tag is comment and has something like case description. I need to do it in python
I have written this to read the large xml file but I don't know how to split it into a new file
testCases = []
countr = 0
xml_iter = et.iterparse('Main.xml', events=('start', 'end'))
for event, elem in xml_iter:
text = elem.text
# if text not in testCases:
# testCases.append(text)
if event == 'start':
print('<%s>' % elem.tag, end = '')
if text != '':
print(text, end = '')
elif event == 'end':
print('<%s>' % elem.tag)
if text != None and "comment" in elem.tag and "#Test Case ID:" in text:
break