XML Type Support Implementation Notes
This topic describes some implementation details that you want to be aware of.
If the XmlSchemaDatatype object represents a list type the object converts the input string value to a list of one or more objects. If the XmlSchemaDatatype represents a union type then an attempt is made to parse the input value as a member type of the union. If the parse attempt fails then the conversion is attempted with the next member of the union and so on until the conversion is successful, or there are no other member types to try, in which case an exception is thrown.
The following describes certain mismatches that can occur between CLR types and XML data types and how they are handled.
xs:duration type is partially ordered in that there are certain duration values that are different but equivalent. This means that for the
xs:duration type value such as 1 month (P1M) is less than 32 days (P32D), larger than 27 days (P27D) and equivalent to 28, 29 or 30 days.
The TimeSpan class does not support this partial ordering. Instead, it picks a specific number of days for 1 year and 1 month; 365 days and 30 days respectively.
For more information on the
xs:duration type, see the W3C XML Schema Part 2: Datatypes Recommendation at http://www.w3.org/TR/xmlschema-2/.
xs:time value is mapped to a DateTime object, the MinValue field is used to initialize the date properties of the DateTime object (such as Year, Month, and Day) to the smallest possible DateTime value.
Similarly, instances of
xs:gMonthDay are also mapped to a DateTime object. Unused properties on the DateTime object are initialized to those from MinValue.