本文介绍了YAML 与 XML 的比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读到多年后将使用 yaml 而不是 xml.请比较每个规格的相对优缺点.

I read that after years yaml will be used instead of xml. Please compare the relative advantages and disadvantages of each specification.

推荐答案

YAML 没有那么冗长.在没有所有括号的情况下,信噪比更高.这使得许多人主观上更容易阅读和编辑.另一方面,它稍微(只是稍微)难以解析.

YAML is much less verbose. The signal-to-noise ratio is higher without all the brackets. This makes it subjectively easier to read and edit for many people. On the flip side, it's slightly (only slightly) harder to parse.

不过,最大的区别在于 XML 旨在成为一种标记语言,而 YAML 实际上更像是一种数据格式.在 YAML 中表示简单的分层数据往往更优雅,但实际标记文本很难表示.

The biggest difference, though, is that XML is meant to be a markup language and YAML is really more of a data format. Representing simple, hierarchical data tends to be more gracefully done in YAML, but actual marked-up text is awkward to represent.

我想补充一点,作为参考,YAML 本质上(尽管不是历史上)是 JSON(Javascript 对象表示法")的更干净"版本,它在很大程度上消除了后者的感知线噪声(括号和大括号).如果您无法为特定项目找到合适的 YAML 库,那么 JSON 是一种支持更广泛的替代方案,具有 YAML 的许多优点.

I'd like to add, for reference, that YAML is essentially (though not historically) a "cleaner" version of JSON ("Javascript Object Notation") that largely eliminates the latter's perceived line noise (brackets and braces). If you can't find a suitable YAML library for a particular project, then JSON is a more widely-supported alternative with many of YAML's advantages.

这篇关于YAML 与 XML 的比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 08:10