如果 YAML 不是标记语言,它是什么? [英] If YAML ain't markup language, what is it?

查看:14
本文介绍了如果 YAML 不是标记语言,它是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看不出是什么让 YAML 不如 XML 成为一种标记语言.标记语言的目的是定义文档的结构,而 YAML 正是这样做的(YAML 代表 YAML 不是标记语言).

I fail to see what makes YAML any less of a markup language than XML. The purpose of a markup language is to define the structure of a document, and YAML does exactly that (YAML stands for YAML ain't markup language).

YAML 应该代表的是,另一种标记语言.

What YAML should instead stand for is, Yet another markup language.

推荐答案

因此,标记语言假定基本文本,通常是人类可读的,然后是直接处理的特殊指示符或标记".这个想法来自一位编辑,他会获取某人手稿的印刷版,并标记"以显示新行的位置、编辑等.

So, a markup language presumes a base text, typically human readable, and then special indicators or "markup" which direct processing. The idea comes from an editor, who would take a printed-version of someone's manuscript, and "mark it up" to show where new lines should go, edits, etc.

这样,SGML 是一种用于声明标记语言的元语言,而 HTML 是一种标记语言.1996-7 年,当 XML 出现时,它作为一种简化的 SGML 元语言被出售,用于创建标记语言.在 XML(和 SGML)中,您有元素来标记"文本的一部分,然后是修改标记的属性.随着时间的推移,XML 的用途远不止文档标记,人们将它用于数据序列化——尽管它从来没有被设计用来做这样的事情.当然,这是要解决的大问题.

In this manner, SGML is a meta-language for declaring markup languages, and HTML is a markup language. In 1996-7, when XML came on the scene, it was sold as a simplified SGML meta-language for creating markup languages. In XML (and SGML), you have elements to "mark" a portion of text, and then attributes that modify the marking. Over time, XML was used for much more than document markup though, people used it for data serialization -- even though it was never designed to do such a thing. Of course, it was the big problem to be solved.

YAML 和 JSON 出现在现场并专注于 data 序列化,而不是文档标记.在这些语言中,根本没有核心文档文本.
因此,YAML Ain't Markup Language 与 XML 的区别非常准确.

YAML and JSON appeared on the scene and focused on data serialization, not document markup. In these languages, there simply isn't a core document text.
Hence, YAML Ain't Markup Language is quite an accurate differentiator from XML.

这篇关于如果 YAML 不是标记语言,它是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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