PHP DOM and single quotes

拜拜、爱过 提交于 2020-03-03 04:47:05

问题


Is there any way to tell DOMDocument to use single quotes instead of double quotes for attributes?


回答1:


No. DOMDocument is a data-oriented access API for XML. And it serializes the documents however it wants to.

There is no ->save() flag http://www.php.net/manual/en/libxml.constants.php in PHP to accomplish it. And other language bindings don't allow it either: Can nokogiri use single quotes for attributes on saving xml?
And this is because libxml itself does provide no means to override this. libxml2/xmlsave.h and others mention no quote-style flags. So, I'm afraid you're really out of luck.



来源:https://stackoverflow.com/questions/5473520/php-dom-and-single-quotes

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!