【发布时间】:2015-11-20 06:29:04
【问题描述】:
我使用 XSD 验证传入的 XML 元素。 XSD 文件
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.rg/2001/XMLSchema"
xmlns:tns="http://xxxy/ervices/V0"
targetNamespace="http://xxxy/ervices/V" elementFormDefault="qualified"
attributeFormDefault="unqualified" >
<xs:complexType name="FailType">
<xs:sequence>
<xs:element name="ConDt" type="xs:date" minOccurs="0" maxOccurs="1" nillable="true"/>
<xs:element name="PreEn" type="xs:string" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
我的 XML 文件
<Pat xmlns="http://xxxy/ervices/V">
<ConDt></ConDt>
</Pat>
我得到元素无效 - 根据其数据类型“http://org/2001/XMLSchema:date”,值 '' 无效 - 字符串 '' 不是有效的日期值。
【问题讨论】: