I have some tags in XML document:
<kat1>42</kat1>
<kat2/>
<kat3/>
and if DOMNode $myNode is "kat2"
$myNode->nodeValue
returns zero instead of null. How to check if it is not paired tag and return NULL if true, else value.
<tag />
is the exact same thing as <tag></tag>
so, all you have to do is check whether or not it's empty. If it's empty it wil be printed as a single tag, if it's not empty it will be be printed with both opening and closing tags.