martinblech / xmltodict

Python module that makes working with XML feel like you are working with JSON
MIT License
5.46k stars 465 forks source link

0.13.0 truncates large(r) XML files #306

Open josyb opened 2 years ago

josyb commented 2 years ago

I have the following code:

    with open(xmlfilespec, 'r') as fdxml:
        print('hello?', os.getcwd(), xmlfilespec)
        print('hello hxml2h.py?', os.getcwd(), xmlfilespec, file=logfile)
        xmllines = fdxml.readlines()
        print(len(xmllines), xmllines[0], file=logfile)
        xmldict = xmltodict.parse(''.join((xmllines)), process_namespaces=False)
        # xmldict = xmltodict.parse(fdxml.read())  # doesn't work
        # xmldict = xmltodict.parse(fdxml)  # doesn't work either

    if verbose:
        print('\n\n-------------------------------------------', file=logfile)
        print('Complete list:', file=logfile)
        pp.pprint(xmldict)
        print('-------------------------------------------', file=logfile)
        print('XML structure:', file=logfile)
        printxmlstructure(xmldict, logfile=logfile)
        print('-------------------------------------------\n\n', file=logfile)

The issue is that the created xmldict is incomplete with v0.13.0 while we have no issue with v0.12.0 I can send you our (large?) file; about 160KiB

fdemmer commented 2 years ago

Has previously been reported in #299.

josyb commented 2 years ago

Excuse me for not opening every 'old' issue; the #299 title did give a clue