Symfony2 - 为什么使用 XML 进行设置/配置? [英] Symfony2 - Why use XML for settings/config?

查看:13
本文介绍了Symfony2 - 为什么使用 XML 进行设置/配置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有兴趣为这些类型的文件中的每一种使用 XML 而不是 YAML:

Is there any interest to use XML over YAML for each of these types of file:

  • 配置
  • 安全
  • 路由
  • 服务
  • 翻译

我想在全球范围内询问 XML 与 YAML 和 JSON,但我会坚持这些主题 :)

I would like to ask XML vs YAML and JSON globally, but I'll stick to these topics :)

推荐答案

在我的公司项目中,我们使用 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.

这篇关于Symfony2 - 为什么使用 XML 进行设置/配置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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