stringbean / scala-xml-compare   2.0.0

Website GitHub

XML Comparison Utils for Scala

Scala versions: 2.13 2.12 2.11

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

XML Comparison Utils for Scala

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


Add the following to your build.sbt:

libraryDependencies += "software.purpledragon.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 =, doc2)
// result1 = XmlDiffers("different text", "John Smith", "Peter Smith")


A companion library is provided for testing XML in Scalatest:

libraryDependencies += "software.purpledragon.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>)


Similarly a companion library for specs2 is provided:

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