Today I was working on a web service that persist a large XML structure sent by an InfoPath form. I found an interesting issue. The XML schema used by InfoPath declares an XML element as following:
<xs:element name="ShippingDate" type="xs:dateTime" nillable="true"/>
That means that the XML stream can be both validated as:
<ShippingDate xsi:nil="true" />
The problem rises when you send the second one to the web method. You'll get a SoapException such as "String was not recognized as a valid DateTime." Ough!! Yes, the DateTime is a value type and then cannot be null!
Is there a solution ? I contacted my friend Christian and asked him if he knows about this issue. After a little IM conversation he suggested to implement a SoapExtension that assign default date times value to empty elements. Too much work for a basic problem. When we will have a DateTime nullable (reference type) ?
My Strongly Typed Collection generator becomes useless with Whidbey. My generator produces more or less 200 lines of code. In Whidbey they becomes:
class MyClasses : List<MyClass>
Pretty simple, not ?
In a recent post, Chris Anderson posted a brief history overview about XAML:
"Here introduces one of our current debates - is XAML a programming language or a resource format? With XAML you can define new types, define interactivity with "def:Code", and specifiy member variables of the type using "ID". XAML also defines the UI appearance of something, and is used for localization scenarios. XAML lacks any imperitive constructs (branching, etc.). XAML is more of a "programming model" rather than a language, so we have left it at that - "XAML is a declarative programming model"."
Reading the story (I've not been at PDC :-( ) I can recognize some similarities with Microsoft InfoPath 2003 form code. For example, a TextBox is coded as:
<span class="xdTextBox" hideFocus="1" title="" xd:xctname="PlainText" xd:CtrlId="CTRL2" tabIndex="0" xd:binding="my:txtName" style="WIDTH: 130px">
<xsl:value-of select="my:txtName" />
ok, that is XSL, but it's very similar to XAML concept. Hope to learn more on XAML...in the near future.