How to compare XML files

后端 未结 5 1754
遇见更好的自我
遇见更好的自我 2021-02-19 11:44

I have two XML files (XSD) which are generated by some tool.
The tool doesn\'t preserve the order of elements so although the content is equal comparing it as text will resu

5条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-19 12:27

    The XML samples are fundamentally different. Even though the content and the hierarchy may be identical the relationships between peers is different. When XML is parsed it is parsed into a structure called a DOM where relationships between units is very important. If you want to discount the nature of relationships between peer entities then you will likely need custom software. I recommend finding some simple open-source XML aware diff tool and adding the additional requirements that you need. I wrote one at http://prettydiff.com/ but I suggest you look around to see what is available before making a decision, because editing somebody else's algorithms may require a bit of heavy lifting.

提交回复
热议问题