Commits

Anonymous committed 04ce2a5

Empty attributes are now ignored by neman.xml.

Comments (0)

Files changed (3)

             <arg value='net.ksojat.neman.json'/>
             <arg value='net.ksojat.neman.web'/>
             <arg value='net.ksojat.neman.xml'/>
+            <arg value='net.ksojat.neman.storage'/>
         </java>
 
         <jar destfile='${build.jar}'>

src/net/ksojat/neman/core.clj

   (:import (clojure.lang RT Reflector)
            (java.util UUID)))
 
+(defn- resource-name [res]
+  (if (.startsWith res "/")
+    res
+    (str "/" (.replace (name (ns-name *ns*)) "." "/") "/" res)))
+
+(defn resource-url [res]
+  (.getResource (RT/baseLoader) (resource-name res)))
+
+(defn resource-as-stream [res]
+  (.getResourceAsStream (RT/baseLoader) (resource-name res)))
+
 (defn uuid
   ([]         (UUID/randomUUID))
   ([uuid-str] (UUID/fromString uuid-str)))

src/net/ksojat/neman/xml.clj

 
 (defmethod patch [Element 'setAttributes] [o _ a]
   (if (map? a)
-    (doseq [[k v] a] (.setAttribute o (name k) v))
+    (doseq [[k v] a]
+      (if v (.setAttribute o (name k) v)))
     (.setAttributes o a)))
 
 (defmethod patch [Element 'addContent] [o _ a]