Hi,
When you want to set a value to node of type whole number, date, time, decimal and date and time then you have to set the nil value false. Use the following code lines to set nil to true to the node.
if (node.GetAttribute("nil", "http://www.w3.org/2001/XMLSchema-instance") != null)
{
if ((node.Value).Length != 0)
node.SetValue(String.Empty);
if (node.MoveToAttribute("nil", "http://www.w3.org/2001/XMLSchema-instance"))
node.DeleteSelf();
// Create xsi:nil attribute with the proper namespace.
node.CreateAttribute("xsi", "nil", "http://www.w3.org/2001/XMLSchema-instance", "true");
}