title: Empty XML element handling in Python
body: <p>I'm puzzled by minidom parser handling of empty element, as shown in following code section.</p>
  
  <pre><code>import xml.dom.minidom
  
  doc = xml.dom.minidom.parseString('&lt;value&gt;&lt;/value&gt;')
  print doc.firstChild.nodeValue.__repr__()
  # Out: None
  print doc.firstChild.toxml()
  # Out: &lt;value/&gt;
  
  doc = xml.dom.minidom.Document()
  v = doc.appendChild(doc.createElement('value'))
  v.appendChild(doc.createTextNode(''))
  print v.firstChild.nodeValue.__repr__()
  # Out: ''
  print doc.firstChild.toxml()
  # Out: &lt;value&gt;&lt;/value&gt;
  </code></pre>
  
  <p>How can I get consistent behavior? I'd like to receive <em>empty string</em> as value of <em>empty element</em> (which <em>IS</em> what I put in XML structure in the first place).</p>