$xmlF->writeElement($fieldName, $fieldVal);
Currently, when $fieldVal
is empty, above will output:
<FieldName/>
Is it possible to skip element entirely (other than with if's) when its value is empty?
You can create condition for that:
if (!empty($fieldVal)) {
$xmlF->writeElement($fieldName, $fieldVal);
}