How to parse XML in CLJS (not CLJ)?

I’ve done many scraping/parsing projects in CLJ using Enlive. Now I’m thinking of a client-side app that can parse and edit given strings of XML without server involvement. Does anyone have recommendations for parsing and generating XML, preferably in CLJS but if not, at least in JS? Web searches are not proving all that fruitful so far.

Seems like this is a good starting point.

1 Like

Is this in a browser context (do you have a DOM API available), or is it for node, or something else?

1 Like
(defn- dom-parse
  [xml]
  (-> (js/DOMParser.)
      (.parseFromString xml "text/xml")
      (.-firstChild)))

And then you can use something like Hickory to get Hiccup from it

(hickory/as-hiccup (dom-parse xml))
2 Likes

Browser context; I’m hoping for a fully client-side solution.

Nice! I have not used Hickory before