如何将 symfony yaml 配置文件转换为 xml 格式? [英] How to convert symfony yaml config files to xml format?

查看:26
本文介绍了如何将 symfony yaml 配置文件转换为 xml 格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要 Symfony 配置文件作为 XML 文件.

I'd like to have Symfony configuration files as XML files.

我知道,symfony-book 中有很多代码示例,但并未显示所有配置类型.

I know, there are many code examples in the symfony-book but not all configurations-types are shown.

有什么方法可以将Symfony演示项目中提供的现有YAML文件转换为XML文件以使用这些文件作为基础吗?

Is there any way to convert the existing YAML files given from the Symfony demo project to XML files to use these files as a base?

我在 /Symfony/vendor/symfony/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php 中找到了一个 dumper 类,但我不知道这个工具是否对我的问题有用,不管怎么用.

I found a dumper class in /Symfony/vendor/symfony/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php but I don't know if this tool is useful for my problem, never mind how to use it.

推荐答案

据我所知,Symfony 中没有通用的 Yaml-to-XML dumper.我从 Fabien 的博客 中找到了这条评论2009年底:

As far as I know, there is no generic Yaml-to-XML dumper in Symfony. I found this comment from Fabien's blog back at the end of 2009:

Fabien — 2009 年 12 月 21 日 10:38 #3

Fabien — December 21, 2009 10:38 #3

@simo:您可以创建一个从 XML 到 YAML 的通用转换器,反之亦然,因为语义完全不同.在 symfony 中,我们同时支持 YAML 和 XML,但每个功能的转换都是手工制作的.

@simo: You can have create a generic converter from XML to YAML or vice-versa, because the semantics are quite different. In symfony, we support both YAML and XML, but the conversion is hand-crafted for each feature.

然而,许多 3rd 方包(包括大多数 FriendsOfSymfony 包)选择使用 XML 作为它们的配置格式.您可以浏览 github 上的代码以获取示例,或者如果您有特定的转换问题,可以将其带到 StackOverflow.

However, many 3rd-party bundles (including most of the FriendsOfSymfony bundles) have chosen to use XML as their configuration format. You can browse through code on github for examples, or if you have a specific conversion question, you can bring it here to StackOverflow.

这篇关于如何将 symfony yaml 配置文件转换为 xml 格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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