3 from xml
.dom
import minidom
, Node
8 def IncreaseCounter(self
, id, how
):
12 return str(datetime
.datetime
.today().isoformat()).split(".")[0]
14 def __init__(self
,filename
="DL-A-2007.stat.xml"):
15 self
.filename
=filename
16 self
.stat
= minidom
.parse (self
.filename
)
17 self
.root
= self
.stat
.documentElement
18 self
.date
= self
.root
.getAttribute ("date")
19 self
.version
= self
.root
.getAttribute ("version")
20 self
.name
= self
.root
.getAttribute ("name")
27 for q
in self
.root
.getElementsByTagName("question"):
28 id.append (q
.getAttribute ("id"))
29 c
.append (q
.getAttribute ("c"))
30 cs
.append (q
.getAttribute ("cs"))
31 ws
.append (q
.getAttribute ("ws"))
32 w
.append (q
.getAttribute ("w"))
36 answers
=[a_code
,a_time
,a_when
]
37 for a
in q
.childNodes
:
38 if a
.nodeType
== Node
.ELEMENT_NODE
:
39 a_code
.append (a
.getAttribute("answer_code"))
40 a_time
.append (a
.getAttribute("needed_time"))
41 a_when
.append (a
.getAttribute("datetime"))
43 print id[0],c
[0],cs
[0],ws
[0],w
[0],answers