Skip to content

stringbean/scala-xml-compare

Folders and files

NameName
Last commit message
Last commit date

Latest commit

762f0c7 · Sep 25, 2019

History

36 Commits
Sep 25, 2019
Sep 25, 2019
Sep 25, 2019
Sep 25, 2019
Aug 20, 2019
Aug 23, 2017
Nov 1, 2018
Nov 1, 2018
Nov 1, 2018
Aug 30, 2019
Sep 25, 2019
Nov 1, 2018
Aug 23, 2017
Sep 25, 2019

Repository files navigation

Build Status Codacy Grade Test Coverage Maven Central - Scala 2.11 Maven Central - Scala 2.12 Maven Central - Scala 2.13

XML Comparison Utils for Scala

scala-xml-compare is a small Scala library for comparing XML documents.

Quickstart

Add the following to your build.sbt:

libraryDependencies += "purpledragon.software.xml" %% "xml-compare" % "<version>"

You can then compare XML using:

val doc1 = <person><name>John Smith</name></person>
val doc2 = <person><name>Peter Smith</name></person>

val result = XmlCompare.compare(doc1, doc2)
// result1 = XmlDiffers("different text", "John Smith", "Peter Smith")

Scalatest

A companion library is provided for testing XML in Scalatest:

libraryDependencies += "purpledragon.software.xml" %% "xml-scalatest" % "<version>" % Test

This then enables the beXml matcher:

val doc = <person><name>John Smith</name></person>
doc should beXml(<person><name>John Smith</name></person>)

specs2

Similarly a companion library for specs2 is provided:

libraryDependencies += "purpledragon.software.xml" %% "xml-specs2" % "<version>" % Test