1

我有一个看起来像这样的 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>

当我尝试使用 VS2008 中的 xsd.exe 从中生成类时,我得到字符串字段而不是日期字段,并发出警告

Schema validation warning: Type 'http://www.w3.org/2001/XMLSchema:datetime' is not declared. Line 13, position 9.

有什么线索吗?

4

1 回答 1

6

呸,没关系。

是区分大小写的问题。

使用的正确形式是

xs:dateTime

代替

xs:datetime
于 2009-01-07T08:58:51.710 回答