本文介绍了clojure-xml / parse是否返回延迟序列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
clojure-xml / parse返回xml文件的地图。
clojure-xml/parse returns a map of an xml file.
(ns xml-lib.core
^{:author "Charles M. Norton",
:doc "xml-lib is an xml parsing library built on clojure-xml.
Created on June 26, 2012"}
(:require [clojure.string :as cstr])
(:require [util.core :as utl])
(:require [clojure.xml :as cjxml]))
(defn ret-xml-data
"Returns a map of the supplied xml file."
[xml-fnam]
(let [test-file-nam (utl/open xml-fnam)]
(cjxml/parse xml-fnam))
返回的map是惰性的,还是应该将parse调用传递给lazy顺序函数?
Is the returned map lazy, or should I pass the parse call into a lazy sequence function?
谢谢。
(ret-xml-data "test.xml")
返回(结果已截断)。
{:tag :TamperExport, :attrs {:xmlns "http://
推荐答案
它使用一个SAX解析器,它将消耗整个xml文档,因此我假设它将创建完全实现的数据结构。
It uses a SAX Parser under the hood, which will consume the entire xml document, so I assume that it will create the fully realized data structure.
这篇关于clojure-xml / parse是否返回延迟序列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!