Difference between #2 and #3 of
REST API and null values in XML

Changes

Title unchanged

REST API and null values in XML

Category unchanged

Tips

Yii version unchanged

Tags unchanged

REST, XML, null

Content changed

[...]
However this is not supported by the current implementation of XmlResponseFormatter because values are always appended as DOMText. This means that, even is I pass a PHP null value, I get `<elem></elem>`.

Therefore, I have extended XmlResponse Formatter as follows.

Firstly, the function format() must be modified because creating $
root as DOMElement makes it immutable while I need to attach the xsi: namespace definition. Therefore I use:




```php
[...]
0 0
0 follower
Viewed: 20 373 times
Version: 2.0
Category: Tips
Tags: null, REST, XML
Written by: marko60
Last updated by: marko60
Created on: Nov 10, 2016
Last updated: 8 years ago
Update Article

Revisions

View all history