sanand0 / xmljson

xmlsjon converts XML into Python dictionary structures (trees, like in JSON) and vice-versa.
MIT License
122 stars 33 forks source link

append() argument must be xml.etree.ElementTree.Element, not lxml.etree._Element #50

Open T-K-233 opened 1 year ago

T-K-233 commented 1 year ago

Get the following error when trying to insert a Python dictionary to element tree.

  ...
    xml_data = xmljson.gdata.etree(robot.json, root=xml.etree.ElementTree.Element("root"))
  File "D:\Documents\Python310\lib\site-packages\xmljson\__init__.py", line 135, in etree
    result.append(elem)
TypeError: append() argument must be xml.etree.ElementTree.Element, not lxml.etree._Element

robot.json is formatted with GData format. The data in this particular case is

robot.json = {'link': {'name': 'part_2', '$t': {}}}