在 XML 成为标准并考虑到它的所有缺点之前,是什么让 XML 如此流行? [英] Before XML became a standard and given all its shortcomings, what made XML so popular?

查看:32
本文介绍了在 XML 成为标准并考虑到它的所有缺点之前,是什么让 XML 如此流行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是的,XML 是人类可读的,但逗号分隔的文本和属性文件也是如此.

Yes XML is human readable but so is comma delimited text and properties files.

XML 臃肿、难以解析、难以在代码中修改,再加上我能想到的许多其他问题.

XML is bloated, hard to parse, hard to modify in code, plus a ton of other problems that I can think about with it.

我的问题是 XML 最吸引人的特性是什么让它如此受欢迎????

My questions is what are XML's most attractive qualities that has made it so popular????

推荐答案

与 CSV 文件相比,它的主要优势之一是它可以轻松表示分层数据.要做到这一点,您要么需要像 XML 这样的自描述树结构,要么需要像 SWIFT 或 EDI 这样的预定义格式(如果您曾经处理过其中任何一个,那么您就会意识到 XML 解析起来很简单)相比之下).

One of the major advantages it has over things like CSV files is that it can represent hierarchical data easily. To do this you either need a self-describing tree structure like XML, or a pre-defined format such as SWIFT or EDI (and if you've ever dealt with either of those, then you'll realise that XML is trivial to parse in comparison).

它实际上很容易解析的原因之一是因为它臃肿".这些结束标记意味着您可以准确地将元素的结束与开始匹配,并在树变得不平衡时进行计算.您无法在 JSON 等轻量级"替代方案中做到这一点.

One of the reasons it's actually quite easy to parse is because it's 'bloated'. Those end tags mean that you can accurately match the end of elements to the start and work out when the tree has become unbalanced. You can't do that in the 'lightweight' alternatives such as JSON.

它易于解析的另一个原因是它从一开始就完全支持 Unicode 编码,因此您不必担心目标系统上的默认代码页是什么,或者如何编码多字节字符,因为该信息都包含在文档中.

Another reason it's easy to parse is because it has had full support for Unicode encodings from the start, so you don't have to worry about what the default code page is on the target system, or how to encode multi-byte characters, because that information is all contained within the document.

我们不要忘记随之而来的其他人工制品,例如定义的描述和验证机制 (XSD) 以及强大的声明性转换机制 (XSLT).

And let's not forget about the other artefacts that came with it like the defined description and validation mechanism (XSD) and the powerful and declarative transformation mechanism (XSLT).

这篇关于在 XML 成为标准并考虑到它的所有缺点之前,是什么让 XML 如此流行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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