SHOW:
|
|
- or go back to the newest paste.
1 | (ns Week3-xml) | |
2 | ||
3 | (use '[clojure.xml :only (parse)]) | |
4 | (def xml-doc (parse (java.io.File. "src/calendar.xml"))) | |
5 | ||
6 | - | (defn resultaat-naam [resultaat] (first (:content (last (:content resultaat)))) ) |
6 | + | (defn resultaat-naam [resultaat] (count (:content resultaat)) ) |
7 | (defn resultaat-cijfer [resultaat] (first (:content (first (:content resultaat)))) ) | |
8 | (defn holiday [elem] {:naam (resultaat-naam elem), :cijfer (resultaat-cijfer elem)}) | |
9 | ||
10 | ||
11 | - | (for [elt (xml-seq xml-doc) :when (= :resultaat(:tag elt))] holiday [elt]) |
11 | + | (for [elt (xml-seq xml-doc) :when (= :resultaat(:tag elt))] (holiday [elt])) |
12 | ||
13 | ||
14 | ||
15 | ||
16 | ||
17 | ||
18 | ||
19 | <?xml version="1.0" encoding="utf-8"?> | |
20 | <tentamenresultaten> | |
21 | <resultaat> | |
22 | <naam>Piet</naam> | |
23 | <cijfer>7</cijfer> | |
24 | </resultaat> | |
25 | <resultaat> | |
26 | <naam>Klaas</naam> | |
27 | <cijfer>10</cijfer> | |
28 | </resultaat> | |
29 | </tentamenresultaten> |