Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP DOM and single quotes

Tags:

dom

php

xml

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

like image 370
Ronald Avatar asked Aug 09 '26 20:08

Ronald


1 Answers

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.

like image 106
mario Avatar answered Aug 11 '26 15:08

mario



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!