title: Get Element Text Using xml mini dom python
body: <p>i am trying to get the text of an element using <code>mini dom</code>, in the following code , i have also tried <code>getText()</code> Method as suggested <a href="https://docs.python.org/3/library/xml.dom.minidom.html" rel="nofollow noreferrer">here</a> , but i am unable to get the desired output, following is my code. I dont get the Text value from the element i am trying to work on.</p>
  
  <pre><code>import xml.dom.minidom
  
  doc = xml.dom.minidom.parse("DL_INVOICE_DETAIL_TCB.xml")
  results = doc.getElementsByTagName("G_TRANSACTIONS")
  def getText(nodelist):
      rc = []
      for node in nodelist:
          if node.nodeType == node.TEXT_NODE:
              rc.append(node.data)
      return ''.join(rc)
  for result in results:
      for element in result.getElementsByTagName("INVOICE_NUMBER"):
          print(element.nodeType)
          print(element.nodeValue)
  </code></pre>
  
  <p>Following is my XML sample</p>
  
  <pre><code>&lt;LIST_G_TRANSACTIONS&gt;
      &lt;G_TRANSACTIONS&gt;
          &lt;INVOICE_NUMBER&gt;31002&lt;/INVOICE_NUMBER&gt;
          &lt;TRANSACTION_CLASS&gt;Invoice&lt;/TRANSACTION_CLASS&gt;
      &lt;/G_TRANSACTIONS&gt;
  &lt;/LIST_G_TRANSACTIONS&gt;
  </code></pre>
  
  <p>I am using the following </p>