【问题标题】:PHP DOM and single quotesPHP DOM 和单引号
【发布时间】:2011-03-29 13:43:45
【问题描述】:

有没有办法告诉 DOMDocument 对属性使用单引号而不是双引号?

【问题讨论】:

    标签: php xml dom


    【解决方案1】:

    没有。 DOMDocument 是一个面向数据的 XML 访问 API。并且它可以随意序列化文档。

    PHP 中没有 ->save() 标志 http://www.php.net/manual/en/libxml.constants.php 来完成它。其他语言绑定也不允许:Can nokogiri use single quotes for attributes on saving xml?
    这是因为 libxml 本身并没有提供任何方法来覆盖它。 libxml2/xmlsave.h 和其他人没有提到引用样式的标志。所以,恐怕你真的不走运。

    【讨论】:

    • 确实如此。 @Ronald,解决为什么首先需要单引号的问题可能更容易......
    猜你喜欢
    • 2011-06-02
    • 1970-01-01
    • 1970-01-01
    • 2014-06-28
    • 1970-01-01
    • 2011-08-03
    • 2012-05-07
    • 2017-05-03
    • 1970-01-01
    相关资源
    最近更新 更多