Sor*_*raz 1 xsd.exe visual-studio-2008
我有一个看起来像这样的XSD(大致)
<xs:schema id="Appointment" targetNamespace="http://tempuri.org/Record.xsd" elementFormDefault="qualified"
attributeFormDefault="qualified" xmlns="http://tempuri.org/Record.xsd" xmlns:mstns="http://tempuri.org/Record.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="Record" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="Record">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:string" minOccurs="0" />
<xs:element name="TimeStart" type="xs:datetime" minOccurs="0" />
<xs:element name="TimeEnd" type="xs:datetime" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
Run Code Online (Sandbox Code Playgroud)
当我尝试使用VS2008中的xsd.exe从它生成类时,我得到字符串字段而不是日期字段,并发出警告
Schema validation warning: Type 'http://www.w3.org/2001/XMLSchema:datetime' is not declared. Line 13, position 9.
Run Code Online (Sandbox Code Playgroud)
有线索吗?
呸,没关系.
是区分大小写的问题.
正确使用的形式是
xs:dateTime
Run Code Online (Sandbox Code Playgroud)
代替
xs:datetime
Run Code Online (Sandbox Code Playgroud)