是否有任何正式方法或已知方法来规范化xml文件以生成差异? [英] Is there any formal way or known way to canonicalize an xml file to generate diffs?

查看:64
本文介绍了是否有任何正式方法或已知方法来规范化xml文件以生成差异?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

WRT工具似乎会在xml之间生成差异,但仍然存在很多问题,所以还没有这个问题,所以任何知道此事的人都会向我显示链接或粘贴任何已经解决此问题的示例。

There seems to be many questions WRT tool to generate diffs between xmls, but there wasn't this question yet, so anyone who knows this show me a link or paste any example anyone already solved this problem.

规范化xml文件意味着

Canonicalizing an xml file means,


  • 重新排列属性的外观

  • 重新排列标签的外观(可通过命令行选项选择)

  • 如果结束没有结束,则插入行尾(CR / CR + LF / LF)标签

  • 插入缩进选项卡(空格)

  • 删除多余的空格和行尾

  • reordering the appearance of attributes
  • reordering the appearance of tags (selectable by command line option)
  • insert line ending(CR/CR+LF/LF) if there isn't at the end of a close tag
  • insert indentation tab(space)
  • remove redundant spaces and line endings

然后您可以清晰地比较xml文件以查看更新的部分。

And then you can cleanly diff the xml files to see which part was updated.

我想使用例程在UNIX环境中规范化,然后在签入版本控制存储库之前尽快。

I want to use the routine to canonicalize in unix environment, as quick as possible, before checking in to version control repository.

推荐答案

XMLStarlet 具有规范化模式de( c14n )。

XMLStarlet has a canonicalization mode (c14n).

这篇关于是否有任何正式方法或已知方法来规范化xml文件以生成差异?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆