Skip to content

Instantly share code, notes, and snippets.

@noisesmith
Created April 7, 2016 02:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noisesmith/5e277b89e2c6cb7c00525378a74a721d to your computer and use it in GitHub Desktop.
Save noisesmith/5e277b89e2c6cb7c00525378a74a721d to your computer and use it in GitHub Desktop.
+user=> (xml-seq (clojure.xml/parse (java.io.File. "sample.xml")))
({:tag :settings, :attrs nil, :content [{:tag :timeout, :attrs nil, :content ["5000"]} {:tag :email, :attrs nil, :content ["example@mail.com"]} {:tag :hosts, :attrs nil, :content [{:tag :host, :attrs {:url "http://computer1.domain.com"}, :content ["COMPUTER1"]} {:tag :host, :attrs {:url "http://computer2.domain.com"}, :content ["COMPUTER2"]} {:tag :host, :attrs {:url "http://computer3.domain.com"}, :content ["COMPUTER3"]}]}]} {:tag :timeout, :attrs nil, :content ["5000"]} "5000" {:tag :email, :attrs nil, :content ["example@mail.com"]} "example@mail.com" {:tag :hosts, :attrs nil, :content [{:tag :host, :attrs {:url "http://computer1.domain.com"}, :content ["COMPUTER1"]} {:tag :host, :attrs {:url "http://computer2.domain.com"}, :content ["COMPUTER2"]} {:tag :host, :attrs {:url "http://computer3.domain.com"}, :content ["COMPUTER3"]}]} {:tag :host, :attrs {:url "http://computer1.domain.com"}, :content ["COMPUTER1"]} "COMPUTER1" {:tag :host, :attrs {:url "http://computer2.domain.com"}, :content ["COMPUTER2"]} "COMPUTER2" {:tag :host, :attrs {:url "http://computer3.domain.com"}, :content ["COMPUTER3"]} "COMPUTER3")
+user=> (pprint *1)
({:tag :settings,
:attrs nil,
:content
[{:tag :timeout, :attrs nil, :content ["5000"]}
{:tag :email, :attrs nil, :content ["example@mail.com"]}
{:tag :hosts,
:attrs nil,
:content
[{:tag :host,
:attrs {:url "http://computer1.domain.com"},
:content ["COMPUTER1"]}
{:tag :host,
:attrs {:url "http://computer2.domain.com"},
:content ["COMPUTER2"]}
{:tag :host,
:attrs {:url "http://computer3.domain.com"},
:content ["COMPUTER3"]}]}]}
{:tag :timeout, :attrs nil, :content ["5000"]}
"5000"
{:tag :email, :attrs nil, :content ["example@mail.com"]}
"example@mail.com"
{:tag :hosts,
:attrs nil,
:content
[{:tag :host,
:attrs {:url "http://computer1.domain.com"},
:content ["COMPUTER1"]}
{:tag :host,
:attrs {:url "http://computer2.domain.com"},
:content ["COMPUTER2"]}
{:tag :host,
:attrs {:url "http://computer3.domain.com"},
:content ["COMPUTER3"]}]}
{:tag :host,
:attrs {:url "http://computer1.domain.com"},
:content ["COMPUTER1"]}
"COMPUTER1"
{:tag :host,
:attrs {:url "http://computer2.domain.com"},
:content ["COMPUTER2"]}
"COMPUTER2"
{:tag :host,
:attrs {:url "http://computer3.domain.com"},
:content ["COMPUTER3"]}
"COMPUTER3")
nil
user=>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment