Skip to content

ENH: read_xml() does not allow to specify huge_tree=True for the 'lxml' parser. #61290

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 of 3 tasks
sergiykhan opened this issue Apr 14, 2025 · 0 comments
Open
1 of 3 tasks
Labels
Enhancement Needs Triage Issue that has not been reviewed by a pandas team member

Comments

@sergiykhan
Copy link

sergiykhan commented Apr 14, 2025

Feature Type

  • Adding new functionality to pandas

  • Changing existing functionality in pandas

  • Removing existing functionality in pandas

Problem Description

read_xml() fails with the error message XMLSyntaxError: xmlSAX2Characters: huge text node.

A similar problem can be overcome when manually parsing the tree like so:

from lxml import etree
with open(filename) as f:
    tree = etree.parse(f, etree.XMLParser(huge_tree=True))

Feature Description

I am not sure what the best way to supply options to the parser would be.

Alternative Solutions

Right now, I have to read the file using the 'etree' parser like so

df = pd.read_xml(
    filename,
    parser='etree',
)

Additional Context

Similarly, the following option could be passed to the parser recover=True.

@sergiykhan sergiykhan added Enhancement Needs Triage Issue that has not been reviewed by a pandas team member labels Apr 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Needs Triage Issue that has not been reviewed by a pandas team member
Projects
None yet
Development

No branches or pull requests

1 participant