Reading XML on python 2.1
<p>So, i'm trying to process a XML file on python.</p>

<p>I'm using minidom as I'm in python 2.1 and there's no change to updating to 3.6. Currently, I have this</p>

<pre><code>import xml.dom.minidom as minidom
import socket
print 'Getting the xml file'
# Get the xml contents
file = open('&lt;filepath&gt;')
#print file
# Get the root of the configuration file
print 'Parsing the xml'
procs = minidom.parse(file)
</code></pre>

<p>But I'm getting this error</p>

<p><a href="http://i.stack.imgur.com/ozT8A.png" rel="nofollow"><img src="http://i.stack.imgur.com/ozT8A.png" alt="Error getting"></a></p>

<p>Any idea? Or, better yet, another way to parse xml without me having to write my own parser...</p>

<p>So, I was able to get this working</p>

<p>For starters, after trying to convince to either update or install a plugin, I was notified that all python scripts are ran on <code>jython</code>, which mean, I have several java libraries to my disposal (wish they could had told me this quite sooner)</p>

<p>So, after some investigation on xml processing on <code>jython</code>, I found out that using <code>Xerces</code> and <code>xas</code> was the key</p>

<p>This is the code I finally used if any one would like to know</p>

<pre><code>from java.io import StringReader

import org.xml.sax as sax
import org.apache.xerces.parsers.DOMParser as domparser

parser = domparser()
document = open('&lt;path to file&gt;').read()
parser.reset()
documentIS = sax.InputSource(StringReader(document))
parser.parse(documentIS)
domtree = parser.getDocument()
results = domtree.getElementsByTagName('&lt;tag name&gt;')
for ix in range(results.getLength()):
    item = results.item(ix).getAttribute("&lt;attribute name&gt;")
</code></pre>

<p>Hope someone else finds this usefull</p>

python xml python-2.1