In an XML schema you can mark an element as nillable
meaning it can take an explicit NULL value. See nillable and minOccurs XSD element attributes for a great explanation.
What I'm curious about is why is it called nillable
? I always see nillable and think it's a typo!
EDIT I appreciate that nil
is a synonym for null
. What I'm wondering is why nil
was chosen, rather than the more common (in computer science) null
. Particularly as it should really be nilable
(note the single L)!
The nillable attribute specifies whether or not an explicit NULL value can be assigned to the element. True enables an instance of the element to have the NULL attribute set to true. The NULL attribute is defined as part of the XML Schema namespace for instances.
The presence of the xsd:nillable attribute in an XSD element means that the corresponding element in the XML file permits null values.
nillable="false" means you can't have the attribute xsi:nil="true". But you don't have this attribute so this won't make it invalid.
The minOccurs attribute specifies the minimum number of times that the element can occur. It can have a value of 0 or any positive integer. The maxOccurs attribute specifies the maximum number of times that the element can occur.
What I'm wondering is why
nil
was chosen, rather than the more common (in computer science)null
This depends on which part of computer science you're coming from!
If you look at programs written in functional languages, you'll see nil
every where, and very seldom null
. And as it happens, XML and all it's siblings such as XSLT are closely related to functional languages.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With