title: Python read a xml 1 -M and create json
body: <p>i have develop a python script taht read a tag of xml file and after convert the result into json.
  Now the problem is that the xml for each one element have some tag (relation 1 - M)</p>
  
  <pre><code>&lt;idpoint&gt;1021&lt;/idpoint&gt;
  &lt;tipopoint&gt;1&lt;/tipopoint&gt;
  &lt;latitude&gt;45.188377380&lt;/latitude&gt;
  &lt;longitude&gt;8.612257004&lt;/longitude&gt;
  &lt;previsione time="2015-07-11T12:00:00"&gt;
  &lt;id_tempo&gt;1&lt;/id_tempo&gt;
  &lt;desc_tempo&gt;sereno&lt;/desc_tempo&gt;
  &lt;symbol_day&gt;1&lt;/symbol_day&gt;
  &lt;temp&gt;33&lt;/temp&gt;
  &lt;/previsione&gt;
  &lt;previsione time="2015-07-11T18:00:00"&gt;
  &lt;id_tempo&gt;1&lt;/id_tempo&gt;
  &lt;desc_tempo&gt;sereno&lt;/desc_tempo&gt;
  &lt;symbol_day&gt;1&lt;/symbol_day&gt;
  &lt;temp&gt;29&lt;/temp&gt;
  &lt;/previsione&gt;
  </code></pre>
  
  <p>My code python read the first tag and when i arrive to tag previsione that is repeat 2 time for the same point i take the first value of first tag previsioni but doesn't take the second.
  I could recreate a same record but this time take the value of second tag previsioni.</p>
  
  <p>this is a snippet of my python code </p>
  
  <pre><code>json_array = [];
  
  for path in files:
      with open(path, 'r') as fr:
          print "Parsing xmldoc %s" % path
  
          xmldoc = minidom.parse(fr)
  
          if tipo == "allerte":
              items = xmldoc.getElementsByTagName("point")
          else:
              items = xmldoc.getElementsByTagName("localita")
  
          for item in items:
              obj = dict()
  
              if tipo == "allerte":
                  obj['id'] = item.getElementsByTagName("idpoint")[0].firstChild.nodeValue
  
  
  
              else:
                  obj['id'] = item.getElementsByTagName("idpoint")[0].firstChild.nodeValue
  
              obj['latitude'] = float(item.getElementsByTagName("latitude")[0].firstChild.nodeValue)
              obj['longitude'] = float(item.getElementsByTagName("longitude")[0].firstChild.nodeValue)
              #TODO: IL symbol code va recuperato dalla prima previsione
              sobj['symbolcode'] = int(item.getElementsByTagName("id_tempo")[0].firstChild.nodeValue)
              json_array.append(obj)
  
  return json.dumps(json_array)
  </code></pre>
  
  <p>Any help to integrate this code for create into json file 2 element for the 2 tag relation?</p>
  
  <p>Thanks</p>