我正在尝试比较此结构中的2个XML:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<att:attivio xmlns:att="http://www.attivio.com/configuration" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.attivio.com/configuration http://www.attivio.com/configuration/attivio-config.xsd">
<schema merge="true" name="default">
<fields default-search-field="content">
<field facet="false" indexed="true" joinable="false" multivalue="false" name="ShipLocations.ID" sort="false" stored="true" tokenize="no" type="string"/>
<field facet="false" indexed="true" joinable="false" multivalue="false" name="ShipLocationsShips.ShipID" sort="false" stored="true" tokenize="no" type="string"/>
<field facet="false" indexed="true" joinable="false" multivalue="false" name="ShipLocations.LocationDesc" sort="false" stored="true" tokenize="yes" type="text">
<properties>
<property name="highlight.scopeMode" value="xml"/>
<property name="highlight.enabled" value="true"/>
<property name="highlight.fragment" value="false"/>
<property name="highlight.fragmentSize" value="2000"/>
<property name="highlight.numFragments" value="1"/>
</properties>
</field>
<field facet="false" indexed="true" name="content" sort="false" stored="false" type="text">
<properties>
<property name="stopwords.mode" value="query"/>
<property name="synonyms.mode" value="on"/>
</properties>
<include-field name="ShipLocations.ID"/>
<include-field name="ShipLocationsShips.ShipID"/>
<include-field name="ShipLocations.LocationDesc"/>
</field>
</fields>
</schema>
</att:attivio>
但是我不能让XMLUnit忽略XML中所有样式和元素的顺序:“字段”,“属性”,“包含字段”等。
到目前为止我得到的代码:
Diff myDiff = DiffBuilder.compare(schema1).ignoreComments()
.ignoreElementContentWhitespace()
.ignoreWhitespace()
.withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byName))
.withTest(schema2)
.checkForSimilar()
.build();
有什么我想念的吗?
谢谢。