`
messi_18
  • 浏览: 96382 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

clojure parse xml

阅读更多
今天玩了下clojure, 试着解析xml。
有几点心得:

1> 确实简练:
(ns work (:require 
    [clojure.xml :as xml]
    [clojure.zip :as zip]
    [clojure.data.zip.xml :as zf] )
)

(defn parse-xml-file
    "parse xml to zipper map"
    [xml-file]
    (zip/xml-zip (xml/parse xml-file))
)


(defn get-value [xml & tags]
	  (apply zf/xml-> 
        xml
        (conj (vec tags) zf/text))
)
(def xml-var (parse-xml-file "test.xml"))
;to get 'a/b'
(get-value xml-var :a :b)


2> 如果a是根节点那么检索不到。这是为什么?待解答。
3> apply 的用法,要在详细研究。
4> vec 与vector 是不同的函数
(vec '(1 2 3));return [1 2 3]
(vector '(1 2 3));return [(1 2 3)]

这一点,要仔细研究。
分享到:
评论
1 楼 IamSungod 2012-03-30  
很有探索精神,学过多种编程语言呀

相关推荐

    Professional.Clojure.1119267277

    Parse the difference between functional and object-oriented programming Understand Clojure performance and capabilities Develop reactive web pages using ClojureScript Adopt an REPL-driven development ...

    Programming Clojure 英文电子版

    这是Programming Clojure 电子版的 纸质版本在美国亚马逊要到2009年3月才能上架 Paperback: 200 pages Publisher: Pragmatic Bookshelf (March 15, 2009) Language: English ISBN-10: 1934356336 ISBN-13: 978-...

    Clojure编程乐趣

    Clojure is an opinionated language—it doesn’t try to cover all paradigms or provide every checklist bullet-point feature. Instead it provides the features needed to solve all kinds of real-world ...

    Practical Clojure.pdf

    Practical Clojure Clojure语言书籍

    clojure eclipse

    clojure clojure clojureclojure clojure

    clojure相关书籍1

    【1】[Clojure编程乐趣](The Joy of Clojure).pdf 【2】Clojure – Functional Programming for the JVM中文版.pdf 【3】Clojure Cookbook.pdf 【4】Clojure Data Analysis Cookbook.pdf 【5】clojure Hand book...

    Clojure电子书合集2(13本)

    [2013] Functional Programming Patterns in Scala and Clojure - Write Lean Programs for the JVM.(Michael Bevilacqua-Linn).[1937785475].pdf+epub.rar [2014] Clojure Cookbook - Recipes for Functional ...

    Clojure可选类型系统TypedClojure.zip

    Typed Clojure 保留了 Clojure 的优势,是 Clojure 的可选类型系统,也可以说是 Clojure 的一个库,改善了大量的静态类型安全检测。主要特性:从 Java 中保护你的 Clojure 程序,进行安全的互操作,正确的使用外部 ...

    Clojure编程乐趣]+clojure_programming.pdf

    Clojure编程乐趣和clojure_programming.pdf两本书

    Clojure电子书合集1(12本)

    [2009] Programming Clojure.(Stuart Halloway).[1934356336].pdf [2010] Functional Programming with Clojure - Simple Concurrency on the JVM.(Tim Berglund, Matthew McCullough).[193650202X].pdf [2010] ...

    Mastering.Clojure.1785

    Learn to handle data using sequences, reducers, and transducers in Clojure Explore the lesser known and more advanced features, constructs, and methodologies of the Clojure language and its ecosystem,...

    Clojure入门教程- Clojure – Functional Programming for the JVM中文版

    Clojure入门教程- Clojure – Functional Programming for the JVM中文版

    [Clojure] Clojure 编程 (英文版)

    [奥莱理] Clojure 编程 (英文版) [奥莱理] Clojure Programming (E-Book) ☆ 出版信息:☆ [作者信息] Chas Emerick, Brian Carper, Christophe Grand [出版机构] 奥莱理 [出版日期] 2012年04月19日 [图书页数...

    clojure1.3.0及资料

    clojure1.3.0及资料,附《Programming Clojure》,《Practical Clojure》

    有关JAVA的译文 Clojure:“挑战”Java编程语言

    Clojure是一个JVM的动态函数式语言,最近发布了1.0版本,版本中Clojure提供了一个健壮的代码。Clojure是一套发展快速的新的编程语言,特别是,它为多核计算做了新的解决方案。在今后的软件设计中无论使用Clojure语言...

    Clojure Data Analysis Cookbook

    Clojure Data Analysis Cookbook

    The Joy of Clojure, 2nd Edition

    The Joy of Clojure, Second Edition is a deep look at the Clojure language. Fully updated for Clojure 1.6, this new edition goes beyond just syntax to show you the "why" of Clojure and how to write ...

    clojure相关书籍2

    【1】Web Development with Clojure(2014.1).pdf 【2】clojure_programming.pdf 【3】Practical Clojure.pdf 【4】Programming Clojure with Emacs.pdf 【5】Programming Concurrency on the JVM(Java虚拟机并发编程...

    Clojure入门教程.pdf

    Clojure入门教程

Global site tag (gtag.js) - Google Analytics