用于比较 xml 文件的工具或库

发布于 2024-07-13 11:10:56 字数 1539 浏览 6 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(13

缱倦旧时光 2024-07-20 11:10:57

我很惊讶没有人提到微软的 XML NotePad

它是免费的,它可以创建一个非常好的比较,告诉哪些元素/属性已更改、移动、删除等:(

抱歉,如果屏幕截图有点宽)。

您还可以将 XLS 应用于 XML 文件并执行各种编辑操作。 非常值得一试。

I am very surprised nobody mentioned Microsoft's XML NotePad

It's free and it can create a pretty good comparison, telling which elements/attributes have changed, moved, been deleted, etc.:

(Sorry if the screenshots are a little wide).

You can also apply XLSes to the XML file and do various editing operations. Well worth a try.

鹿童谣 2024-07-20 11:10:57

如果我理解你的问题,你可能有一个使用 XML 文件作为数据存储的应用程序,并且 GUI 将“技术”标签名称抽象为“用户友好”标签 - 我再次假设。 因此,以类似的方式看待差异将是一个自然的延伸。 我还假设您的应用程序没有遵循“抽象”概念的差异工具。

我做了一些搜索,发现一个应用程序 (ExamXML) 似乎与突出显示功能很接近。 我下载了评估版本并针对它测试了您的文件:

http://www.programmedintheusa.com/images /stack547399.png

它在突出差异方面做得非常好。 它看起来非常具有互动性,并且会弹出许多差异。 看起来您可以更改它使用的颜色,因此也许您可以使用灰色和白色来弱化标签。 它似乎还有很多您可以为用户预设的选项。

我想指出的是,您将很难找到不显示标签名称的 XML 比较工具,因为标签提供了内容上下文。 如果去掉上下文,就很难理解所显示的数据。 无论如何,也许这个工具可能会有所帮助。 您是否也尝试过向您的用户展示其中一些工具,看看他们愿意容忍什么,有时他们可能会让您感到惊讶。 希望这可以帮助!

If I understand your problem, you likely have an application that uses XML files as the data storage and the GUI abstracts the "technical" tag names into "user friendly" labels - again, I am assuming. So it would be a natural extension to view differences in a similar way. I am also assuming your application doesn't have a diff facility that follows the "abstraction" concept.

I did some searching and found one app (ExamXML) that seems to come close with highlighting features. I downloaded the eval version and tested your files against it:

http://www.programmedintheusa.com/images/stack547399.png

It does a pretty good job of highlighting the differences. It seems pretty interactive and pops up with how many differences. It looks like you can change the colors it uses, so maybe you can use grays and whites to de-emphasize the tags. It also seems to have a lot of options that you can pre-set for your users as well.

I want to note that you will be hard pressed to find an XML comparison tool that will not show the tag names, as the tags are what give the content context. If you take away context, it becomes difficult to understand the data being displayed. Anyhow, maybe this tool might be helpful. Have you also tried to show your users some of these tools and see what they are willing to tolerate, sometimes they may surprise you. Hope this helps!

筑梦 2024-07-20 11:10:57

SourceGear 的 DiffMerge 对单用户免费:

http://www.sourcegear.com/diffmerge/

SourceGear's DiffMerge is free for a single-user:

http://www.sourcegear.com/diffmerge/

征棹 2024-07-20 11:10:57

我可能会尝试 DeltaXML + XSLT 转换来获得您想要的特定结果。 使用带有 XML 的纯文本比较工具的一个问题是,即使内容本身没有变化,XML 文档的物理形式(其缩进等)也可能会发生变化,这可能会导致大量误报。 DeltaXML 是一个非常好的比较基于文档的 XML 的工具。

此外,根据用户使用的编辑器,它可能内置 XML 差异。 例如,Arbortext Editor 有一个很好的工具,可以显示文本(而不是标签),并突出显示/删除更改。

I might try DeltaXML + an XSLT transform to get the specific result that you want. One problem with using plain-text compare tools with XML is that the physical form of an XML document (its indenting, etc.) can change even if the content itself doesn't, which could lead to a lot of false positives. DeltaXML is a very good tool for comparing document-based XML.

Also, depending on the editor your users use, it may have XML differencing built-in. For example, Arbortext Editor has a good tool that shows the text (not the tags) with changes highlighted / struck-through.

三生殊途 2024-07-20 11:10:57

Altova diffDog
XML Spy 和 diffDog 是出色的工具。 把它们从我冰冷、死气沉沉的手中撬开,类似的东西。

Altova diffDog
XML Spy and diffDog are exceptional tools. Pry them from my cold dead hands, kinda stuff.

小瓶盖 2024-07-20 11:10:57

正如@BobbyShaftoe 已经提到的,Beyond Compare 非常出色。 然而,对于合并,我喜欢使用 Araxis Merge。 我们经常将它用于类似的目的。

至于您对用户非技术能力的评论:

感谢您的回复...但这些似乎都太技术性了。 我的用户通常看不到 xml 标签,因为他们的 XML 创作工具将它们抽象化了。 是否有任何工具可以显示文本内容的差异,但不显示(或取消强调)xml 标记。

我要把这个扔出去:你的用户应该学习。 如果您让他们合并和更改 XML 文件(我假设可能是为了记录保存或应用程序配置),那么他们应该至少对自己正在做的事情有一个基本的了解。 他们不必是 XML 专家也能使用列出的工具并完成工作。

但是,如果要求您的用户对他们正在做的工作有基本的了解是不可能的,那么我建议您自己编写一个配置实用程序并将其提供给您的最终用户,而不是依赖第三方软件。

Beyond Compare is excellent as @BobbyShaftoe has already mentioned. For merging however, I like to use Araxis Merge. We use it for similar purposes quite often.

As far as your comment about the nontechnical ability of your users:

Thanks for the Responses... But these all seem too technical. My users normally do not see the xml tags because their XML authoring tool abstracts them away. Are there any tools that display differences in the text content, but do not show (or de-emphazise) the xml tags.

I'm going to throw this out there: your users should learn. If you have them merging and changing XML files - I'm assuming potentially for record keeping or application configuration - then they should have at least a rudimentary understanding of what they're doing. They don't have to be XML whizzes to use the tools listed and get the job done.

If, however, requiring your users to have a rudimentary knowledge of the job they are doing is impossible, then I would suggest writing a configuration utility yourself and delivering it for your end users, rather than relying on 3rd party software.

沙与沫 2024-07-20 11:10:57

尝试使用 Microsoft MSDN XML 中的 XML 记事本,它有一个比较 XML 文件。 不知道它有多好。

Try XML Notepad from Microsoft MSDN XML it has a compare XML files. No idea how good it is.

拥抱没勇气 2024-07-20 11:10:57

您尝试过 examdiff 吗? 当然,它仍然是一个技术工具,但它很容易使用。 它有一个拖放界面来比较文件。

Have you tried examdiff? Of course it's still a tech tool, but it's easy to work with. It has a drag and drop interface to compare files.

神妖 2024-07-20 11:10:57

我总是使用 kdiff3。 它易于使用,最多可以比较 3 个文件。
http://kdiff3.sourceforge.net/

I always use kdiff3. It's easy to use and can compare up to 3 files.
http://kdiff3.sourceforge.net/

哽咽笑 2024-07-20 11:10:57

您可能会找到XML Diff and Patch GUI Tool(示例代码位于MSDN)更好地满足您的需求:它仍然显示标签,但强调文本的差异。 既然您获得了代码,那么您只需付出一点努力就可以更精确地根据您的要求进行定制。

尽管该示例相对较旧(2004 年 7 月,起源于 2002 年),但它可以轻松升级到 Visual Studio Express C# 2008。 下载 示例 来自 MSDN 站点,如果/当安装程序 MSI 提到“.NET 代码示例中的 SQLXML Bulkload”时 - 事实并非如此!

You may find The XML Diff and Patch GUI Tool (sample code on MSDN) meets your needs a little better: it still shows tags, but emphasizes the difference in text. Since you get the code, for a little more effort you could tailor it more precisely to your requirements.

Although the sample is relatively elderly (July 2004, and has its roots in 2002) it upgrades to Visual Studio Express C# 2008 painlessly. Don't be put off when downloading the sample from the MSDN site if/when the installer MSI mentions "SQLXML Bulkload in .NET Code Sample" - it's not!

小嗲 2024-07-20 11:10:57

无论是通过编程还是 UI,您都可以使用 MSDN 中的 XmlDiff、XmlPatch 工具和库
有关其工作原理的详细信息,请查看指南。

http://msdn.microsoft.com/en-us/library/aa302294。 ASPX

Either programatically or UI, you can use XmlDiff, XmlPatch tools and library from MSDN
For details how it work, check out the guide.

http://msdn.microsoft.com/en-us/library/aa302294.aspx

我早已燃尽 2024-07-20 11:10:57

Oxygen XML Editor 拥有我发现的最好的 XML diff 集合工具。 有几种不同的算法可供比较,因此,如果默认算法不适合您,请尝试 Syntax Aware 或其他一些算法(现在,我使用的是版本 8,尚未升级到版本 10,所以 ymmv,但我怀疑XML 差异变得更糟)。

Oxygen XML Editor has the best collection XML diff's tool I have found. There are several different Algorithms for comparison, so if the default doesn't work for you, try Syntax Aware or some of the other Algorithms (now, I am using version 8 and haven't upgraded to version 10 so ymmv, but I doubt that the XML diff has gotten worse).

Bonjour°[大白 2024-07-20 11:10:57

我知道这是一个古老的线程,但是 Project: Merge 是一个新的 Windows 应用程序,可以管理双向和XML 文件的三向合并和比较。 (三向操作假设有两个文件都派生自一个公共基本文件。)

您可能需要告诉它如何识别各个元素才能完美地处理您的文件,但这很容易做到,而且您'只需要做一次。

I know this is an oldish thread, but Project: Merge is a new Windows application that can manage two-way and three-way merges and comparisons of XML files. (A three-way operation assumes there are two files that are both derived from a common base file.)

You might need to tell it how to identify individual elements to work perfectly on your files, but that's easy enough to do, and you'll only need to do it once.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文