This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-10-07
Channels
- # aleph (15)
- # beginners (18)
- # boot (18)
- # business (1)
- # cider (11)
- # cljs-dev (13)
- # cljsrn (19)
- # clojure (14)
- # clojure-austin (8)
- # clojure-dusseldorf (1)
- # clojure-finland (1)
- # clojure-greece (118)
- # clojure-poland (3)
- # clojure-russia (46)
- # clojure-spec (65)
- # clojure-uk (18)
- # clojurebridge (3)
- # clojurescript (16)
- # cloverage (7)
- # core-async (8)
- # cursive (74)
- # datomic (28)
- # editors (3)
- # emacs (3)
- # ethereum (5)
- # hoplon (19)
- # jobs-rus (18)
- # lein-figwheel (1)
- # off-topic (2)
- # om (107)
- # om-next (4)
- # onyx (23)
- # pedestal (23)
- # proton (3)
- # protorepl (1)
- # re-frame (108)
- # reagent (10)
- # ring-swagger (15)
- # spacemacs (2)
- # specter (11)
- # testing (7)
- # untangled (79)
- # vim (4)
- # yada (53)
https://github.com/stleary/JSON-java/blob/master/XML.java @seancorfield how do libraries like this work then?
By choosing a specific conversion strategy. You could do just that in clojure with the aforementioned libraries if you like.
It’s also worth bearing in mind that JSON / EDN / Clojure data structures are very, very similar (asides from richer types in EDN / Clojure — but their structure is very similar). That is not true for XML. The JSON-java
library just happens to pick an (opinionated) option for you that you can’t control. Great if you like its choice — sucks if you don’t. The various XML parsing libraries in Clojure all produce different structures and some of them provide a degree of control over what that structure is. So reading XML -> Clojure data structures gives you the most freedom and the most choice (and then Clojure to JSON is "trivial" and near 1:1). @josh_tackett /cc @donaldball
Hi, I don't know if this place is right place to ask this question. So, my question, are there any Clojure function that doesn't work on ClojureScript function??
Probably the concurrency stuff? pmap, agent…? I’d have to go digging in the docs.
cljs.user=> (map inc [1 2 3 4])
(2 3 4 5)
cljs.user=> (pmap inc [1 2 3 4])
ERROR - undefined is not an object (evaluating 'cljs.user.pmap.call')
cljs.user=> (def q (agent nil))
ERROR - undefined is not an object (evaluating 'cljs.user.agent.call')
Based on trying them at http://clojurescript.io
@seancorfield The data structure that clojure.data.xml
produces is completely unusable...
its a complete mess
@josh_tackett the mess is inherent to XML (which is partly why people have been moving away from XML to JSON), you can't really blame clojure.data.xml
for that IMO
@val_waeselynck The question remains, what is the best way to parse it then? because clojure.data.xml
is no the way to do it
why not? Sure, you have to do some post-processing afterwards, but Clojure really isn't the worst language to use to transform data structures
note that you can use things like clojure.data.zip
to traverse the data structure
@val_waeselynck the data structure that is returned is soooooo deeply nested that it is very difficult to traverse
Some find spectre useful for working with deeply nested data structures
@josh_tackett the clojure.data.xml format is the most suitable representation for processing you'll find I think. The alternative is hiccup syntax, which is great for writing but terrible for processing
@plexus Its ok I just put in the hours and destructured it