Skip to content

Commit b7878f9

Browse files
committed
README reformat and clarification
1 parent 5ff464c commit b7878f9

1 file changed

Lines changed: 26 additions & 24 deletions

File tree

README.md

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ data.xml has the following features:
77

88
* Parses XML documents into Clojure data structures
99
* Emits XML from Clojure data structures
10-
* No additional dependencies if using 1.6
10+
* No additional dependencies if using JDK >= 1.6
1111
* Uses StAX internally
1212
* lazy - should allow parsing and emitting of large XML documents
1313

@@ -17,7 +17,11 @@ Please report bugs using JIRA [here](http://dev.clojure.org/jira/browse/DXML).
1717

1818
## Installation
1919

20-
Latest stable release: 0.0.8
20+
Latest stable release: `0.0.8`
21+
22+
Latest preview release: `0.2.0-alpha3`
23+
24+
(The main features of the `0.2.0` series are XML Namespace support and Clojurescript support)
2125

2226
* [All Released Versions](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.clojure%22%20AND%20a%3A%22data.xml%22)
2327

@@ -26,44 +30,42 @@ Latest stable release: 0.0.8
2630
### Maven
2731
For Maven projects, add the following XML in your `pom.xml`'s `<dependencies>` section:
2832

33+
For stable:
34+
2935
<dependency>
3036
<groupId>org.clojure</groupId>
3137
<artifactId>data.xml</artifactId>
3238
<version>0.0.8</version>
3339
</dependency>
3440

35-
### Leiningen
36-
Add the following to the `project.clj` dependencies:
37-
38-
[org.clojure/data.xml "0.0.8"]
39-
40-
## Installation - Alpha
41-
42-
Latest alpha release: 0.2.0-alpha2
43-
44-
* [All Released Versions](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.clojure%22%20AND%20a%3A%22data.xml%22)
45-
46-
* [Development Snapshot Versions](https://oss.sonatype.org/index.html#nexus-search;gav~org.clojure~data.xml~~~)
41+
---
4742

48-
### Maven
49-
For Maven projects, add the following XML in your `pom.xml`'s `<dependencies>` section:
43+
For preview:
5044

5145
<dependency>
5246
<groupId>org.clojure</groupId>
5347
<artifactId>data.xml</artifactId>
54-
<version>0.2.0-alpha2</version>
48+
<version>0.2.0-alpha3</version>
5549
</dependency>
5650

5751
### Leiningen
5852
Add the following to the `project.clj` dependencies:
5953

60-
[org.clojure/data.xml "0.2.0-alpha2"]
54+
For stable:
55+
56+
[org.clojure/data.xml "0.0.8"]
57+
58+
---
59+
60+
For preview:
61+
62+
[org.clojure/data.xml "0.2.0-alpha3"]
6163

6264
## Examples
6365

64-
The examples below assume you have added a `use` for data.xml:
66+
The examples below assume you have added a `:refer :all` for data.xml:
6567

66-
(use 'clojure.data.xml)
68+
(require '[clojure.data.xml :refer :all])
6769

6870
data.xml supports parsing and emitting XML. The parsing functions will
6971
read XML from a
@@ -202,15 +204,15 @@ Below is an example of parsing an XHTML document:
202204

203205
(parse-str "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
204206
<foo:html xmlns:foo=\"http://www.w3.org/1999/xhtml\"/>")
205-
207+
206208
#...Element{:tag :xmlns.http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml/html,
207209
:attrs {},
208210
:content ()}
209211

210212
Emitting namespaced XML is usually done by using `alias-uri` in combination with clojure's built-in `::kw-ns/shorthands`:
211213

212214
(alias-uri 'xh "http://www.w3.org/1999/xhtml")
213-
215+
214216
(emit-str {:tag ::xh/html
215217
:content [{:tag ::xh/head} {:tag ::xh/body :content ["DOCUMENT"]}]})
216218

@@ -224,7 +226,7 @@ It is also allowable to use `javax.xml.namespace.QName` instances, as well as st
224226

225227
(emit-str {:tag (qname "http://www.w3.org/1999/xhtml" "html")})
226228
(emit-str {:tag "{http://www.w3.org/1999/xhtml}html"})
227-
229+
228230
<?xml version=\"1.0\" encoding=\"UTF-8\"?><a:html xmlns:a=\"http://www.w3.org/1999/xhtml\"></a:html>
229231

230232
### Namespace Prefixes
@@ -284,7 +286,7 @@ By default the parser attaches location information as element meta,
284286
(let [input "<a><b/>\n<b/></a>"
285287
location-meta (comp :clojure.data.xml/location-info meta)]
286288
(is (= 1 (-> input parse-str location-meta :line-number)))
287-
289+
288290
To elide location information, pass `:location-info false` to the parser:
289291

290292
(parse-str your-input :location-info false)

0 commit comments

Comments
 (0)