parse xml

kostia kostya.demchuk at
Fri Oct 15 19:49:18 CEST 2010

I have xml file:
<?xml version="1.1" encoding="UTF-8"?>

I want to get the value of n (= 50000) inside my python program, I'm
doing this:

import xml.dom.minidom
from xml.dom.minidom import Node
doc = xml.dom.minidom.parseString("boolean_width.xml")
n = doc.getElementsByTagName("root")[0].firstChild.nodeValue.strip()
print n

and it is failed. How to get the value? Please, help.

More information about the Python-list mailing list