Skip to content

Latest commit

 

History

History
27 lines (20 loc) · 991 Bytes

README.md

File metadata and controls

27 lines (20 loc) · 991 Bytes

XML Hiccup

xml-hiccup

Clojure(Script) implementation of an XML parser that, more or less directly, converts an XML file into Hiccup data without trying to be clever about it.

Comments and superfluous whitespace are deliberately not preserved, while namespaces are converted into regular Clojure namespaces. No attempt is made to map namespace URIs to namespace aliases.

Usage

This example shows how to parse a File, though it could also be a String or an InputStream.

(require '[dk.cst.xml-hiccup :as xh]
         '[clojure.java.io :as io])

(xh/parse (io/file "test/test-1307-anno-tei.xml"))

NOTE: ClojureScript only supports parsing XML strings!

Why even use this?

For various reasons, I needed a library that can turn XML into identical Hiccup in both my backend code and my frontend code. This library does that.