Reputation: 518
I am trying to generate xml from xsd for one date tag, inorder to have nil =true in xml if the value is null in database,
i have tried putting nillable="true"
in xsd.
is there any alternative to this.
below is my xsd sample line
<xs:element name="abc" type="xs:date" minOccurs="0" nillable="true">
...............
</xs:element>
Upvotes: 0
Views: 76
Reputation: 163645
In my view the best way of representing absent data in XML is to have an element or attribute that is defined as optional, and to omit the element or attribute when there is no value. You've defined the element as optional, so just omit it to represent null.
I'm told that some people prefer to have the element present but marked as nil, but I've never seen any point in doing this myself.
Having the element both optional and nillable seems to be inviting confusion. Do absence and nillness mean the same thing, or do they mean something different?
Upvotes: 1