Fork me on GitHub
#clojure-europe
<
2020-05-27
>
synthomat06:05:25

good morning!

slipset06:05:26

You might very well think that, but you have to work with MongoDB this morning...

slipset06:05:28

The MongoDB query "language" makes you wish a language specified by a commitee.

synthomat07:05:15

haha, I am sometimes tempted to use mongodb for a quick project set up but then I remember that I regret the choice so often…

synthomat07:05:21

actually it is quite satisfying once you (think you) start understanding the aggregation pipeline before you hit the next unsolvable problem

slipset07:05:43

The aggregation pipeline is a disappointment that just keeps on giving.

slipset07:05:57

Not only does it only solve 80% of your problem, it does it slowly as well.

synthomat07:05:28

next up: parsing xml in clojure. what am I even doing

synthomat08:05:00

I think i just used clojure.xml, looks sufficient

plexus09:05:57

note that if you're generating xml with clojure that clojure.xml does not properly escape text nodes, so it's really easy to generate invalid xml

plexus09:05:11

huge bug IMO

synthomat09:05:33

ugh interesting, thanks!

synthomat09:05:54

fortunately I’m just parsing a xml report

synthomat09:05:18

btw. is there a library to easily traverse an xml? don’t know if xpath is the most convenient way already

slipset10:05:09

There is the xml zipper thingy?

plexus10:05:29

Enlive might also be interesting

plexus10:05:51

Gives you css like selectors

synthomat10:05:32

awesome thank you all!

synthomat10:05:11

I’m still in the search of a serious personal project, where I can apply clojure and learn it in production 😅

helios10:05:14

xml-zip makes it a little less painful. Also I've used this function to extract maps a bit better:

(defn extract-map [xml-map]
  (into {} (->> xml-map
                (map (fn [xml-tag]
                       [(csk/->kebab-case-keyword (name (:tag xml-tag)))
                        (let [c (:content xml-tag)]
                          (if (every? xml/element? c)
                            (extract-map c)
                            (first c)))])))))

helios10:05:29

(i really don't care for those prefixes 😄 )

synthomat10:05:08

can’t be bad if if it makes use of kebab!

jasonbell13:05:31

I’m a fan of Specter for walking XML files. Been a long while since I used it though. https://github.com/MastodonC/kixi.hecuba.dcc.measurements/tree/master/src/kixi/hecuba/dcc/measurements

RAMart19:05:43

If you need XML namespace support, test it first. Only few Clojure XML libraries support this (highly useful) feature.