[REF]Hy Base XML better naming for child

This commit is contained in:
Fabien BOURGEOIS 2019-09-22 10:28:56 +02:00
parent 82155b3cc2
commit c45d527fff

View File

@ -29,13 +29,13 @@
(defn xmlchild [parent children]
"Handling of children (ie non root) XML Nodes with/o text and subchildren
(recursive)"
(for [c children]
(if (string? c)
(setv (. parent text) c)
(for [child children]
(if (string? child)
(setv (. parent text) child)
(do
(setv attrs (dfor [k v] (.items (get c "attrs")) [(str k) (str v)]))
(setv new_parent (.SubElement ET parent (get c "tag") attrs))
(setv subchildren (get c "children"))
(setv attrs (dfor [k v] (.items (get child "attrs")) [(str k) (str v)]))
(setv new_parent (.SubElement ET parent (get child "tag") attrs))
(setv subchildren (get child "children"))
(if subchildren (xmlchild new_parent subchildren))))))
(defn xmln [tag &optional attrs children text]