Got a bit further here. I want to be able to get tag namespaces without a
:root tag (that includes the namespace definition). Assume the below code
has (require '[clojure.data.xml :as xml]).


Working with attributes is fine.

(def e1 (xml/element :use {:xmlns:xlink "http://testing";,
                           :xlink:href "#whiskers",
                           :transform "scale(-1 1) translate(-140 0)"}))


Namespace prefixes is possible with tags; however, I had to add the
unwanted :root tag (that includes ns definition)

(def e2 (xml/element :root {:xmlns:thing "http://thing"}
                     (xml/element :thing:use {})))

(def e3 (xml/element :root {:xmlns:thing "http://thing"}
                     (xml/sexp-as-element
                      [:thing:first {}
                       [:thing:second {}]])))

(defn print-esequel [elem]
  (println (xml/indent-str elem)))



The resulting XML is close. But we want the tag namespaces, without the
root node

user> (print-esequel process/e2)

<?xml version="1.0" encoding="UTF-8"?>
<root xmlns:thing="http://thing";>
  <thing:use/>
</root>

user> (print-esequel process/e3)

<?xml version="1.0" encoding="UTF-8"?>
<root xmlns:thing="http://thing";>
  <thing:first>
    <thing:second/>
  </thing:first>
</root>



Tim Washington
Interruptsoftware.com <http://interruptsoftware.com>


On Tue, May 6, 2014 at 3:24 PM, Timothy Washington <twash...@gmail.com>wrote:

> Hi there,
>
>
> *A)* I'm just writing some SOAP XML, trying to use 
> data.xml<https://github.com/clojure/data.xml>.
> This SO 
> thread<http://stackoverflow.com/questions/10868050/clojure-data-xml-create-key-named-xlinkhref>
>  outlines
> how to write out namespace aware XML. But the example is for a namespace on
> an attribute. I'm combing through the code now, but does anyone know how to
> set this up?
>
>
> *B)* There's actually this Fuller XML 
> Support<http://dev.clojure.org/display/DXML/Fuller+XML+support>proposal 
> (referring to this
> thread<https://groups.google.com/forum/#!msg/clojure-dev/3_jkBrdQKgs/dUwtevWqlwkJ>),
> and this Namespaced 
> XML<http://dev.clojure.org/display/DXML/Namespaced+XML>proposal. But I don't 
> see that namespaces are fully implemented in any of
> the core libs.
>
> I only see this ArmageDOM <https://github.com/pepijndevos/ArmageDOM> lib,
> which supports namespaces. Anything else out there that I've missed?
>
>
> Thanks
>
> Tim Washington
> Interruptsoftware.com <http://interruptsoftware.com>
>
>
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to