While parsing a xml file receiving " xml.etree.ElementTree.ParseError: not well-formed"

138 Views Asked by At
import xml.etree.cElementTree as ET
def get_attr_number(node):
    root=ET.fromstring(node)
    length=0
    for i in root:
        l=len(i.attrib)
        length+=l
    print (length)

if __name__=="__main__":
    n=int(input())
    for i in range(n):
        node=input()
        print (node)
        get_attr_number(node)

I am not able to pass the xml string to the function here.Kindly help me. Thanks in advance!

0

There are 0 best solutions below