Skip to content

Commit 97b5771

Browse files
committed
Update badges and add quickstart
1 parent adc545c commit 97b5771

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

README.md

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,51 @@
11
[![Build Status](https://img.shields.io/travis/stringbean/scala-xml-compare/master.svg)](https://travis-ci.org/stringbean/scala-xml-compare)
2+
[![Codacy Grade](https://img.shields.io/codacy/grade/47939504d2cc49b0a7eb21f6bcc5c24d.svg?label=codacy)](https://www.codacy.com/app/stringbean/scala-xml-compare)
23
[![Test Coverage](https://img.shields.io/codecov/c/github/stringbean/scala-xml-compare/master.svg)](https://codecov.io/gh/stringbean/scala-xml-compare)
34
[![Maven Central - Scala 2.11](https://img.shields.io/maven-central/v/software.purpledragon.xml/xml-compare_2.11.svg?label=scala%202.11)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22software.purpledragon%22%20a%3A%22xml-compare_2.11%22)
45
[![Maven Central - Scala 2.12](https://img.shields.io/maven-central/v/software.purpledragon.xml/xml-compare_2.12.svg?label=scala%202.12)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22software.purpledragon%22%20a%3A%22xml-compare_2.12%22)
6+
[![Maven Central - Scala 2.13-M5](https://img.shields.io/maven-central/v/software.purpledragon.xml/xml-compare_2.13.0-M5.svg?label=scala%202.13-M5)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22software.purpledragon%22%20a%3A%22xml-compare_2.13.0-M5%22)
57

6-
# XML Comparison Utils for Scala
8+
# XML Comparison Utils for Scala
9+
10+
`scala-xml-compare` is a small Scala library for comparing XML documents.
11+
12+
## Quickstart
13+
14+
Add the following to your `build.sbt`:
15+
16+
```scala
17+
libraryDependencies += "purpledragon.software" %% "scala-xml" % "<version>"
18+
```
19+
20+
You can then compare XML using:
21+
22+
```scala
23+
val doc1 = <person><name>John Smith</name></person>
24+
val doc2 = <person><name>Peter Smith</name></person>
25+
26+
val result = XmlCompare.compare(doc1, doc2)
27+
// result1 = XmlDiffers("different text", "John Smith", "Peter Smith")
28+
```
29+
30+
### Scalatest
31+
32+
A companion library is provided for testing XML in Scalatest:
33+
34+
```scala
35+
libraryDependencies += "purpledragon.software" %% "scala-scalatest" % "<version>" % Test
36+
```
37+
38+
This then enables the `beXml` matcher:
39+
40+
```scala
41+
val doc = <person><name>John Smith</name></person>
42+
doc should beXml(<person><name>John Smith</name></person>)
43+
```
44+
45+
### specs2
46+
47+
Similarly a companion library for specs2 is provided:
48+
49+
```scala
50+
libraryDependencies += "purpledragon.software" %% "scala-specs2" % "<version>" % Test
51+
```

0 commit comments

Comments
 (0)