开发者

XS:date returns an error with format YYYYMMDD

<xs:element name="BeginDate" type="xs:string">
   <xs:simpleType>
   开发者_开发百科 <xs:restriction base="xs:string">
        <xs:pattern value="\d{8}"/>
    </xs:restriction>
    </xs:simpleType>
</xs:element>

In the XML I gave

     <BeginDate>20100721</BeginDate>

but it returns an error ... there is a problem with the code here .. but i am using a validated code :(

So I'm a bit blocked


You have defined the content type twice. You have:
1) attribute type on <xs:element>
2) <xs:simpleType> block as a child of <xs:element>.

You can't have both. In this case, you don't need the type attribute.


I don't see how that snippet can even be valid, given the </xs:simpleType name="CustomDate"> thrown in near the end... do I see a copy-paste error there?


Why do you think the error lies with the regular expression ? Your XML is not valid. What error message do you get ? Edit: you changed it, but it's still not valid (there is a name attribute in simpleType that should not be used there).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜