且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Symfony2 - 为什么使用 XML 进行设置/配置?

更新时间:2023-11-19 17:18:10

在我的公司项目中,我们使用 YAML,因为它更具可读性.最易读.可读性最强.

In my company projects for each of mentioned above points we use YAML because it is more readable. The most readable. The readablest.

编辑:

我能想象的在 YAML 上使用 XML 的唯一抽象情况 - 可能适用于一些动态文件编写器,因为使用 更容易操作节点SimpleXML 或类似的东西.例如,如果您需要定义一些配置文件,在测试中构建模式等......

The only abstract situation I can imagine for using XML over YAML - is probably for some dynamic file writers, since it is easier to manipulate with nodes using SimpleXML or something like that. For example, if you need to define some configuration file, build schemas in tests etc...

但很难想象另一种情况.

But it is hard to imagine another situation.

另一个

由于我的回答被接受,我不能不同意 m2mdas - 正如他在他的 在下面回答,使用 XML 的另一件事是 IDE 的自动完成支持.

Since my answer was accepted, I cannot disagree with m2mdas - as he mentioned in his answer below, another thing that makes sense for using XML is IDE's autocompletion support.