How to not hide empty XML nodes PHP
<p>I was wondering how to not just return the closing XML node if it is empty as can be seen with the CustomerFax node below and to also return an the opening node with no content such as OrderType node.. Thanks </p>

<pre><code>&lt;PushedOrders clientID="0" domainID="0" username="" password=""&gt;
&lt;Order&gt;
&lt;OrderType&gt;&lt;/OrderType&gt;
&lt;WebOrderID&gt;&lt;/WebOrderID&gt;
&lt;CustomerFax/&gt;
&lt;/Order&gt;
&lt;/PushedOrders&gt;
</code></pre>

<p>EDIT Adding PHP code that i'm currently using which only returns closing tags when empty.. When I view page source of the sample xml above the empty nodes return  between the node tags:</p>

<pre><code>$xml = new SimpleXMLElement('&lt;PushedOrders/&gt;');

$xml-&gt;addAttribute(XML_ATTRIBUTE_CLIENTID, '0');
$xml-&gt;addAttribute(XML_ATTRIBUTE_DOMAINID, '0');
$xml-&gt;addAttribute(XML_ATTRIBUTE_USERNAME, '');
$xml-&gt;addAttribute(XML_ATTRIBUTE_PASSWORD, '');

$order = $xml-&gt;addChild('Order');

$content = $order-&gt;addChild('OrderType');
$content = $order-&gt;addChild('WebOrderID');
$content = $order-&gt;addChild('CustomerFax');

echo formatXML($xml-&gt;saveXML('SalesOrder'));
</code></pre>
