clojure.xml / emit发生了什么? [英] What happened to clojure.xml/emit?

查看:75
本文介绍了clojure.xml / emit发生了什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

许多博客都引用了clojure.xml / emit(或clojure.contrib.lazy-xml / emit)功能,但1.2文档中似乎没有。

Many blogs refer to the clojure.xml/emit (or clojure.contrib.lazy-xml/emit) function, but it seems to be absent from the 1.2 documentation.

它被弃用了吗?是什么代替了它?

Was it deprecated? What has replaced it?

它可以用于编写Clojure编码的XML(例如: {:tag:address:content {:tag:街道...}} )?

Can it be used to write Clojure-encoded XML (e.g.: {:tag :address :content {:tag :street ...} })?

更新:我查看了<$ c $的源代码c> clojure.contrib.lazy-xml / emit (由克里斯·豪斯(Chris Houser)提供),尽管它也不是官方的,但它似乎比 clojure更稳定。 xml / emit

UPDATE: I looked at the source code for clojure.contrib.lazy-xml/emit (by Chris Houser) and, although it too is not "official", it looks like a more stable solution than clojure.xml/emit.

顺便说一句,我发现了clojure和clojure-contrib源代码,它们是写得很好,惯用的示例。 Clojure(尤其是大师,Rich Hickey,两位Stuarts,Chris Houser等编写的部分)我需要花一些时间研究该代码。

BTW, I have "discovered" the clojure and clojure-contrib source code as great examples of well-written, idiomatic Clojure (especially the parts written by the masters, Rich Hickey, the two Stuarts, Chris Houser, etc.) I'll need to spend some time studying that code.

推荐答案

奇怪的是,当您(使用'clojure.xml)时, clojure.xml / emit 仍然存在 1.2.0中REPL处的命名空间。

Strangely enough, clojure.xml/emit still exists when you (use 'clojure.xml) that namespace at the REPL in 1.2.0.

要验证:

user=> (use 'clojure.xml)
user=> (emit (parse "http://feeds.feedburner.com/burningonesblog"))

完整披露我使用有用的(ns-map'user)函数

For full disclosure I discovered this using the useful (ns-map 'user) function

user=> (doc ns-map)
-------------------------
clojure.core/ns-map
([ns])
  Returns a map of all the mappings for the namespace.
nil

现在请注意,关于它们从1.2中的文档中消失,您是完全正确的( clojure.xml clojure.contrib.lazy-xml )用于 prxml 并不是您要找的东西。我无法说出为什么,但是在检查其文档字符串后,它们不再出现在Web界面中的原因就显而易见了。

Now please note that you are entirely correct about their disappearing from the documentation in 1.2 (clojure.xml and clojure.contrib.lazy-xml) for all but prxml which isn't really what you're looking for. I can't speak to why that is the case but the reason they no longer show up in the web interface becomes evident upon examining their docstring.

user=> (doc emit)
-------------------------
clojure.xml/emit
([x])
  nil
nil

现在在 Google Group 表示不推荐使用 emit 函数,原因有两个。

Now there is this thread over at the Google Group which indicates that use of the emit function is discouraged for 2 reasons.


  1. 它没有记录,并且

  2. 它通常不会产生有效的xml(尽管我想如果您知道您的数据有效,它将发出有效的xml)。

在该线程结束时,Stuart Halloway讨论了一个扩展Clojure的XML支持的项目。

At the end of that thread, Stuart Halloway talks about a project to extend Clojure's XML support.

当然,总是会浸入Java池并在Java端使用任何出色的XML工具。听起来,clojure的XML故事现在大部分是在解析中讲述的。

Of course there's always dipping into the Java pool and using any of the excellent XML tools on the Java end. It sounds like clojure's XML story is mostly told in parsing at this point.

希望有帮助。

这篇关于clojure.xml / emit发生了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆