store/[org.clojure/clojure "1.8.0"] clj::clojure.xml/parse

Official Documentation

Add notes
Arities
==================================================
   [s]
   [s startparse]

Docstring
==================================================
  Parses and loads the source s, which can be a File, InputStream or
  String naming a URI. Returns a tree of the xml/element struct-map,
  which has the keys :tag, :attrs, and :content. and accessor fns tag,
  attrs, and content. Other parsers can be supplied by passing
  startparse, a fn taking a source and a ContentHandler and returning
  a parser

Source

(defn parse
  "Parses and loads the source s, which can be a File, InputStream or
  String naming a URI. Returns a tree of the xml/element struct-map,
  which has the keys :tag, :attrs, and :content. and accessor fns tag,
  attrs, and content. Other parsers can be supplied by passing
  startparse, a fn taking a source and a ContentHandler and returning
  a parser"
  {:added "1.0"}
  ([s] (parse s startparse-sax))
  ([s startparse]
    (binding [*stack* nil
              *current* (struct element)
              *state* :between
              *sb* nil]
      (startparse s content-handler)
      ((:content *current*) 0))))

Example 1

Edit
(require '[clojure.xml :as xml]
         '[clojure.zip :as zip])

;; convenience function, first seen at nakkaya.com later in clojure.zip src
(defn zip-str [s]
  (zip/xml-zip 
   (xml/parse
    (java.io.ByteArrayInputStream.
     (.getBytes s)))))
;; => #'user/zip-str

;; parse from xml-strings to internal xml representation
(zip-str "<a href='nakkaya.com'/>")
;; => [{:tag :a, :attrs {:href "nakkaya.com"}, :content nil} nil]

;; root can be rendered with xml/emit-element
(xml/emit-element (zip/root [{:tag :a, :attrs {:href "nakkaya.com"}, :content nil} nil]))
;; > <a href='nakkaya.com'/>
;; => nil
;; printed (to assure it's not lazy and for performance). The output can be captured via with-out-str

Uses on crossclj