clojure.xml questions

53 views
Skip to first unread message

Shantanu Kumar

unread,
Oct 30, 2010, 2:52:23 AM10/30/10
to Clojure
Hi,

1. I notice there is just the "parse" function mentioned as public:
http://clojure.github.com/clojure/clojure.xml-api.html

I used the other functions in clojure.xml (emit, emit-element) and the
var 'element' -- they appear to work fine for me. Are they just
undocumented or not guaranteed to be maintained in future versions of
Clojure?

2. The emitted XML string does not have indentation. Is there a way to
fix that? I know there is 'prxml' in contrib but the format it expects
is different (a vector) from what 'emit' expects (a map).

Regards,
Shantanu

Chris Perkins

unread,
Oct 30, 2010, 3:29:56 PM10/30/10
to Clojure
On Oct 30, 2:52 am, Shantanu Kumar <kumar.shant...@gmail.com> wrote:
> Hi,
>
> 1. I notice there is just the "parse" function mentioned as public:http://clojure.github.com/clojure/clojure.xml-api.html
>
> I used the other functions in clojure.xml (emit, emit-element) and the
> var 'element' -- they appear to work fine for me. Are they just
> undocumented or not guaranteed to be maintained in future versions of
> Clojure?

I'm pretty sure emit is undocumented for a reason - the stuff it emits
is not, in general, valid XML. Use it at your peril.

user=> (clojure.xml/emit {:tag :foo :content ["<&>!!!"]})
<?xml version='1.0' encoding='UTF-8'?>
<foo>
<&>!!!
</foo>

- Chris

Stuart Halloway

unread,
Oct 30, 2010, 3:55:43 PM10/30/10
to clo...@googlegroups.com
Hi Shantanu,

In general, Clojure's public API consists of only those vars that both (1) are public and (2) have a docstring. Anything else is undocumented, subject to change, and should be avoided.

If you want to get involved with Clojure's XML support, I have just created a space in Confluence to discuss design of a new clojure.data.xml library: http://dev.clojure.org/display/DXML/Home.

This is not currently a top priority for the Clojure/core team, but we will definitely provide design and implementation review if somebody in the community wants to lead the charge.

Cheers,
Stu

Stuart Halloway
Clojure/core team at Relevance
http://clojure.com
http://thinkrelevance.com

> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@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+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

Reply all
Reply to author
Forward
0 new messages