<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).
精彩评论