XML2Dict icon indicating copy to clipboard operation
XML2Dict copied to clipboard

Issue when 2 children have same name

Open josephernest opened this issue 11 years ago • 0 comments

This XML, which has 2 children called "many" will cause a problem :

<?xml version="1.0" encoding="utf-8"?>
<mydocument>
  <and>
    <many>foo</many>
    <many>bar</many>
  </and>
  <and>
    <many>blah</many>
  </and>  
  <plus>element as well</plus>
</mydocument>

Here is the result after XML2Dict :

{'mydocument': {'and': [{'many': [{}, {}]}, {'many': 'blah'}],
                'plus': 'element as well'}}

Problem :

print d['mydocument']['and'][0]['many'][0]

should be 'foo', and we get {} instead.

josephernest avatar Feb 18 '14 10:02 josephernest