Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
14
Task/XML-Input/Clojure/xml-input-1.clj
Normal file
14
Task/XML-Input/Clojure/xml-input-1.clj
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
(import '(java.io ByteArrayInputStream))
|
||||
(use 'clojure.xml) ; defines 'parse
|
||||
|
||||
(def xml-text "<Students>
|
||||
<Student Name='April' Gender='F' DateOfBirth='1989-01-02' />
|
||||
<Student Name='Bob' Gender='M' DateOfBirth='1990-03-04' />
|
||||
<Student Name='Chad' Gender='M' DateOfBirth='1991-05-06' />
|
||||
<Student Name='Dave' Gender='M' DateOfBirth='1992-07-08'>
|
||||
<Pet Type='dog' Name='Rover' />
|
||||
</Student>
|
||||
<Student DateOfBirth='1993-09-10' Gender='F' Name='Émily' />
|
||||
</Students>")
|
||||
|
||||
(def students (parse (-> xml-text .getBytes ByteArrayInputStream.)))
|
||||
3
Task/XML-Input/Clojure/xml-input-2.clj
Normal file
3
Task/XML-Input/Clojure/xml-input-2.clj
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
(doseq [{:keys [tag attrs]} (xml-seq students)]
|
||||
(if (= :Student tag)
|
||||
(println (:Name attrs))))
|
||||
Loading…
Add table
Add a link
Reference in a new issue