3 from xml
.dom
import minidom
, Node
8 self
.filename
="DL-A-2007.stat.xml"
9 self
.stat
= minidom
.parse (self
.filename
)
10 self
.root
= self
.stat
.documentElement
11 self
.date
= self
.root
.getAttribute ("date")
12 self
.version
= self
.root
.getAttribute ("version")
13 self
.name
= self
.root
.getAttribute ("name")
20 for q
in self
.root
.getElementsByTagName("question"):
21 id.append (q
.getAttribute ("id"))
22 c
.append (q
.getAttribute ("c"))
23 cs
.append (q
.getAttribute ("cs"))
24 ws
.append (q
.getAttribute ("ws"))
25 w
.append (q
.getAttribute ("w"))
29 answers
=[a_code
,a_time
,a_when
]
30 for a
in q
.childNodes
:
31 if a
.nodeType
== Node
.ELEMENT_NODE
:
32 a_code
.append (a
.getAttribute("answer_code"))
33 a_time
.append (a
.getAttribute("needed_time"))
34 a_when
.append (a
.getAttribute("datetime"))
36 print id[0],c
[0],cs
[0],ws
[0],w
[0],answers
40 #print s.date,s.version,s.name