clemense / yourdfpy

Python parser for URDFs
MIT License
122 stars 13 forks source link

XML error with lxml 5.0.0 and libxml 2.12 #52

Open stephane-caron opened 7 months ago

stephane-caron commented 7 months ago

Mentioning here an XML error that hits yourdfpy since lxml 5.0.0 when loading the Go1 description from https://github.com/unitreerobotics/unitree_ros/tree/master/robots/go1_description/urdf

2024-01-02T10:08:46.0517945Z   File "/home/runner/work/robot_descriptions.py/robot_descriptions.py/.tox/loader-yourdfpy/lib/python3.8/site-packages/collada/__init__.py", line 210, in __init__
2024-01-02T10:08:46.0519697Z     self.xmlnode = ElementTree.ElementTree(element=None,
2024-01-02T10:08:46.0520666Z   File "src/lxml/etree.pyx", line 3183, in lxml.etree.ElementTree
2024-01-02T10:08:46.0521806Z   File "src/lxml/parser.pxi", line 1955, in lxml.etree._parseDocument
2024-01-02T10:08:46.0522961Z   File "src/lxml/parser.pxi", line 1975, in lxml.etree._parseMemoryDocument
2024-01-02T10:08:46.0524057Z   File "src/lxml/parser.pxi", line 1862, in lxml.etree._parseDoc
2024-01-02T10:08:46.0525564Z   File "src/lxml/parser.pxi", line 1145, in lxml.etree._BaseParser._parseDoc
2024-01-02T10:08:46.0526850Z   File "src/lxml/parser.pxi", line 618, in lxml.etree._ParserContext._handleParseResultDoc
2024-01-02T10:08:46.0528089Z   File "src/lxml/parser.pxi", line 728, in lxml.etree._handleParseResult
2024-01-02T10:08:46.0529191Z   File "src/lxml/parser.pxi", line 657, in lxml.etree._raiseParseError
2024-01-02T10:08:46.0529995Z   File "<string>", line 83
2024-01-02T10:08:46.0530832Z lxml.etree.XMLSyntaxError: xmlSAX2Characters: huge text node, line 83, column 10000427

Reproduction instructions in this thread.

This error coincides with the release of lxml 5.0.0. Feedback from lxml maintainers in https://bugs.launchpad.net/lxml/+bug/2047826 suggests it is caused by an update of libxml to 2.12 (formerly 2.10 with lxml < 5.0.0).

I don't know if this behavior is triggered by a decision in yourdfpy or pycollada, but in case the latter holds this issue is also reported in the pycollada issue tracker.