VS2008:在架构文件上运行 xsd.exe 会出现 XMLSchema:datetime 未声明

发布于 2024-07-10 22:21:39 字数 1316 浏览 5 评论 0原文

我有一个看起来像这样(大致)的 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.

有任何线索吗?

I have a an XSD that looks like this (roughly)

<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>

When I try to generate classes from it using the xsd.exe from VS2008 I get string fields instead of date fields, and a warning that

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

Any clues?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

赠佳期 2024-07-17 22:21:39

呸,没关系。

是区分大小写的问题。

使用的正确形式是

xs:dateTime

而不是

xs:datetime

Bah, nevermind.

Was case sensitivity issue.

The correct form to use was

xs:dateTime

instead of

xs:datetime
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文