{"id":15494263,"url":"https://github.com/andyglow/scala-xml-diff","last_synced_at":"2025-04-22T20:23:47.773Z","repository":{"id":9506453,"uuid":"28087162","full_name":"andyglow/scala-xml-diff","owner":"andyglow","description":"Scala XML Diff","archived":false,"fork":false,"pushed_at":"2022-06-13T19:18:57.000Z","size":90,"stargazers_count":9,"open_issues_count":1,"forks_count":7,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-29T18:36:29.389Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andyglow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-16T13:00:53.000Z","updated_at":"2022-06-13T18:13:08.000Z","dependencies_parsed_at":"2022-09-08T02:20:24.036Z","dependency_job_id":null,"html_url":"https://github.com/andyglow/scala-xml-diff","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyglow%2Fscala-xml-diff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyglow%2Fscala-xml-diff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyglow%2Fscala-xml-diff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyglow%2Fscala-xml-diff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andyglow","download_url":"https://codeload.github.com/andyglow/scala-xml-diff/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250316737,"owners_count":21410601,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T08:12:57.467Z","updated_at":"2025-04-22T20:23:47.754Z","avatar_url":"https://github.com/andyglow.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Scala XML Diff\n[![Build Status](https://cloud.drone.io/api/badges/andyglow/scala-xml-diff/status.svg)](https://cloud.drone.io/andyglow/scala-xml-diff)\n[![codecov](https://codecov.io/gh/andyglow/scala-xml-diff/branch/master/graph/badge.svg?token=iEGY6XNcz0)](https://codecov.io/gh/andyglow/scala-xml-diff)\n[![mvn](https://img.shields.io/badge/dynamic/json.svg?label=scala\u0026nbsp;2\u0026query=%24.response.docs%5B0%5D.latestVersion\u0026url=https%3A%2F%2Fsearch.maven.org%2Fsolrsearch%2Fselect%3Fq%3Dscala-xml-diff_2.13%26start%3D0%26rows%3D1)](https://search.maven.org/artifact/com.github.andyglow/scala-xml-diff_2.13/)\n[![mvn](https://img.shields.io/badge/dynamic/json.svg?color=03A7FF\u0026label=scala\u0026nbsp;3\u0026query=%24.response.docs%5B0%5D.latestVersion\u0026url=https%3A%2F%2Fsearch.maven.org%2Fsolrsearch%2Fselect%3Fq%3Dscala-xml-diff_3%26start%3D0%26rows%3D1)](https://search.maven.org/artifact/com.github.andyglow/scala-xml-diff_3/)\n\nTool to compare `scala.xml.Node`s with detailed comparison result\n\n## Usage\n\n### build.sbt\n```\nlibraryDependencies += \"com.github.andyglow\" %% \"scala-xml-diff\" % ${LATEST_VERSION} % Compile\n```\n\n#### Import\n```scala\nimport com.github.andyglow.xml.diff._\n```\n\n#### REPL example\n```scala\nscala\u003e \u003cfoo/\u003e =?= \u003cfoo/\u003e\nres0: com.github.andyglow.xml.diff.package.XmlDiff = Eq\n\nscala\u003e \u003cfoo/\u003e =?= \u003cbar/\u003e\nres1: com.github.andyglow.xml.diff.package.XmlDiff = Neq(List(UnequalElem(foo,List(UnequalName(foo,bar)))))\n\nscala\u003e \u003cfoo x=\"a\"/\u003e =?= \u003cfoo x=\"b\"/\u003e\nres2: com.github.andyglow.xml.diff.package.XmlDiff = Neq(List(UnequalElem(foo,List(UnequalAttribute(x,a,b)))))\n\nscala\u003e \u003cfoo\u003e\u003cbar key=\"val1\" key2=\"val2\"/\u003e\u003c/foo\u003e =?= \u003cfoo\u003e\u003cbar key=\"val2\" key3=\"val3\"/\u003e\u003c/foo\u003e\nres3: com.github.andyglow.xml.diff.package.XmlDiff = Neq(List(\n  UnequalElem(foo,List(\n    UnequalElem(bar,List(\n      UnequalAttribute(key,val1,val2),\n      AbsentAttribute(key2,val2),\n      RedundantAttribute(key3,val3)))))))\n      \n// not ignoring whitespace      \nscala\u003e \u003cjaz\u003efoo\u003c/jaz\u003e =?= \u003cjaz\u003efoo \u003c/jaz\u003e\nres4: com.github.andyglow.xml.diff.package.XmlDiff = Neq(List(\n  UnequalElem(jaz,List(\n    AbsentNode(foo),\n    RedundantNode(foo )))))\n\n// ignoring whitespace      \nscala\u003e \u003cjaz\u003efoo\u003c/jaz\u003e =#= \u003cjaz\u003efoo \u003c/jaz\u003e\nres5: com.github.andyglow.xml.diff.package.XmlDiff = Eq\n```\n\n#### Scalatest example\n```scala\nimport org.scalatest.xml.XmlMatchers._\n```\n\n```scala\n\"MyRestService\" must {\n  \"generate proper xml\" in {\n    val document: xml.NodeSeq = service.call(...)\n    document should beXml(\n      \u003cdocument\u003e\n        \u003ctitle\u003eInvoice\u003c/title\u003e\n        \u003cversion\u003e0.6.2\u003c/version\u003e\n        \u003cheader\u003e\u003c/header\u003e\n        \u003ccontent\u003e\n          \u003cline id=\"...\"\u003e...\u003c/line\u003e\n        \u003c/content\u003e\n      \u003c/document\u003e\n    )\n  }\n  \n  // it is also possible to match negative scenarios\n  \"be able to distinguish \u003cbar/\u003e from \u003cfoo/\u003e\" in {\n    \u003cbar/\u003e should not beXml \u003cfoo/\u003e\n  }\n  \n  // you then can match ignoring whitespace\n  \"match not counting leading/trailing whitespaces\" in {\n    \u003cfoo\u003ex\u003c/foo\u003e should beXml (\u003cfoo\u003e x \u003c/foo\u003e, ignoreWhitespaces = true)\n  }\n  \n  // the same could be done using not beXml\n  \n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandyglow%2Fscala-xml-diff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandyglow%2Fscala-xml-diff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandyglow%2Fscala-xml-diff/lists"}