Liking cljdoc? Tell your friends :D

xmltojson.xmltojson


maybe-vectorclj

(maybe-vector v)

tucks things into a vector, if they aren't already.

tucks things into a vector, if they aren't already.
sourceraw docstring

merge-to-vectorclj

(merge-to-vector m1 m2)

With two input maps, associate common keys into vectors and return result map containing all input data. Coerces common key values into vectors. Input maps: {:a 1 :b 2 :c 3} {:a 2 :b 4 } Example Output {:a [1 2] :b [2 4] :c 3}

With two input maps, associate common keys into vectors and return result map
containing all input data.  Coerces common key values into vectors.
Input maps:
  {:a 1 :b 2 :c 3}
  {:a 2 :b 4 }
Example Output
{:a [1 2] :b [2  4] :c 3}
sourceraw docstring

nil-if-emptyclj

(nil-if-empty m)

If empty return nil. Useful for a list like this: [] to go to this: nil

If empty return nil. Useful for a list like this: [] to go to this: nil 
sourceraw docstring

parseclj

(parse xml-map)
(parse {:keys [tag] :as xml-map}
       {:keys [force-list] :or {force-list #{}} :as opt-map})

Receives clojure xml map (as provided by clojure(.data).xml) and returns json-like hash map.

opt-map Optional second map with keys [force-list, attr-prefix, strip-whitespace?] specify lists to be forced into vectors, what to prefix xml attributes with, and to strip-whitespace.

Receives clojure xml map (as provided by clojure(.data).xml) and returns 
 json-like hash map.

`opt-map` Optional second map with keys [force-list, attr-prefix,
strip-whitespace?] specify lists to be forced into vectors,  what to prefix
xml attributes with, and to strip-whitespace.
sourceraw docstring

prefix-keywordsclj

(prefix-keywords attrs-prefix hash-map)

Prefixes keywords in a map, and returns same map with prefixed arguments.

(prefix-keywords "new_" ) => {:new_a 1}

Prefixes keywords in a map, and returns same map with prefixed arguments.

(prefix-keywords  "new_" )
=> {:new_a 1} 
sourceraw docstring

xml-merge-partsclj

(xml-merge-parts {:keys [attrs content]}
                 {:keys [attrs-prefix strip-whitespace?]
                  :or {attrs-prefix "@" strip-whitespace? true}
                  :as opt-map})

Merges :attrs and :content to :tag of xml parsed through clojure.(data).xml. Applies post-processing via a postwalk. TODO other post-processing fn's?

Merges :attrs and :content to :tag of xml parsed through clojure.(data).xml.
Applies post-processing via a postwalk.
  TODO other post-processing fn's?
sourceraw docstring

xml-only-textclj

(xml-only-text m)

If XML is only a text node return that, to be stuffed into the parent tag..

If XML is only a text node return that, to be stuffed into the parent tag..
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close