1
我想在一個Junit測試中比較兩個XML。 我使用XMLUnit進行xml的比較。請告訴我是否有任何簡單的方法可以忽略xml中correlation-id
的比較。在編輯XML時忽略某些元素XMLUnit
XML1:
<?xml version="1.0" encoding="UTF-8"?>
<response>
<bih-metadata>
<result>Error</result>
<correlation-id>ID:925977d0-83cd-11e6-b94d-c135e6c73218</correlation-id>
<error-message>SAXParseException: The entity name must immediately follow the '&' in the entity reference.</error-message>
</bih-metadata>
</response>
XML2:
<?xml version="1.0" encoding="UTF-8"?>
<response>
<bih-metadata>
<result>Error</result>
<correlation-id>ID:134345d0-83cd-11e6-b94d-c135e6c73218</correlation-id>
<error-message>SAXParseException: The entity name must immediately follow the '&' in the entity reference.</error-message>
</bih-metadata>
</response>
你能不能也請添加您的樣本碼? –