How to compare XML files

后端 未结 5 1546
你的背包
你的背包 2021-02-19 11:50

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:38

    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.

提交回复
热议问题