I'm using the simple-xml framework (http://simple.sourceforge.net/home.php) for serializing objects.
Is there a built-in function or option, so that null will be converted to nil="true":
XML:
<example xsi:nil="true"/>
with xmlns:xsi="http://www.w3.org/2001/XML-Schema-instance"
Thanks
Not directly, but you can add this behaviour by implementing a custom
Converter. This allows both directions, Serialization and Deserialization.Just don't forget the
AnnotationStrategy(shown in the link above).Update
This will produce following XML if an empty value is set:
Otherwise the actual value is used.