scala val xml1 = a method="1" href="2" ref="3" onclick="4"Hello/axml1: scala.xml.Elem = a ref="3" href="2" onclick="4" method="1"Hello/ascala val xml2 = a ref="3" href="2" onclick="4" method="1"Hello/axml2: scala.xml.Elem = a href="2" ref="
scala> val xml1 = <a method="1" href="2" ref="3" onclick="4">Hello</a> xml1: scala.xml.Elem = <a ref="3" href="2" onclick="4" method="1">Hello</a> scala> val xml2 = <a ref="3" href="2" onclick="4" method="1">Hello</a> xml2: scala.xml.Elem = <a href="2" ref="3" onclick="4" method="1">Hello</a> scala> xml1 == xml2 res8: Boolean = false
作为示例,xml1和xml2具有相同的内容,但属性具有不同的顺序,结果为false.那么,如何比较这样的xmls?
这看起来像你的工具:xml-test: A diff-like tool for XML