Subject:Is it possible to have empty dates in xml? Author:Mark Maltby Date:21 Jun 2006 04:54 AM
If I have a xml node of a type date or dateTime and that node is empty, when i go to validate it against the schema, i get the following error:
Error parsing '' as date datatype.
The element: 'TargetDate' has an invalid value according to its data type.
Currently I have been not writing this node to the xml file to get around this problem, but this doesn't seem to be the best solution. What if I want to visually display that this node exists and still can be empty. What am I not understanding about the basic rules? Is there any other data type that work this way?
Subject:Re: Is it possible to have empty dates in xml? Author:(Deleted User) Date:21 Jun 2006 05:09 AM
Hi Mark,
in order to allow an empty element you need to:
1) mark the element definition in the schema as "nillable" adding the
attribute nillable="true"
2) add the xsi:nil="true" to the empty instance in the XML file
Subject:Re: Is it possible to have empty dates in xml? Author:(Deleted User) Date:21 Jun 2006 06:19 AM
Hi Mark,
in your XML fragment there is no xsi:nil attribute (the "nillable" attribute in the schema simply tells that the element *may* be empty in some cases, but it's the xsi:nil attribute in the XML file that marks that specific element as being without value).