问题
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))
Is the returned map lazy, or should I pass the parse call into a lazy sequence function?
Thanks.
(ret-xml-data "test.xml")
returns (result truncated).
{:tag :TamperExport, :attrs {:xmlns "http://
回答1:
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.
回答2:
the short anser is no, clojure-xml likely won't do what you want.
data.xml is the lazy sucessor to clojure-xml
https://github.com/clojure/data.xml
来源:https://stackoverflow.com/questions/11213083/does-clojure-xml-parse-return-a-lazy-sequence