According to W3C standards, if you have a nillable element with a nil value, you are supposed to format it like this:
<myNillableElement xsi:nil="true" />
But if you use this LinqToXml statement...
element.Add(
new XElement(ns + "myNillableElement", null);
...the resulting XML is...
<myNillableElement />
...which is invalid. And not just invalid according to W3C, invalid according to Microsoft's own XML/XSD validator. So, next time you validate your XML, you get errors.
Am I missing some switch that can turn on correct handling of nillable elements?
Thanks.