I try to parse the XML file looks like:
<?xml version="1.0" encoding="utf-8"?>
<config>
<basic logdir = "../log/" workthreadcnt=1 maxday="180" />
</config>
I used xml.dom.minidom, such as:
from xml.dom.minidom import parse
import xml.dom.minidom
domtree = xml.dom.minidom.parse("cfg.xml")
and used xml.etree.ElementTree, such as:
import xml.etree.ElementTree as ET
tree = ET.parse("cfg.xml")
Both of them didn't work until I changed the attribute
workthreadcnt=1
to
workthreadcnt="1"
My questions is: If I insist on using the first format,how to make it work ?