is there a way to link equal type definitions together?
example code:
<xsd:element name="a">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:pattern value="|(([1-9]|[12][0-9]|3[01])/([0-9]|1[12])/[0-9]{1,4})"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="b">
<xsd:simpleType>
<xsd:restriction base="xsd开发者_Go百科:string">
<xsd:pattern value="|(([1-9]|[12][0-9]|3[01])/([0-9]|1[12])/[0-9]{1,4})"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
Now the type definition of element a and b are the same. is there a way to "link" those types together so that i do not have to repeat the typing?
Ok, I see. The easiest way to go is to create a named type:
<xsd:simpleType name="PatternType">
<xsd:restriction base="xsd:string">
<xsd:pattern value="|(([1-9]|[12][0-9]|3[01])/([0-9]|1[12])/[0-9]{1,4})" />
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="a" type="tns:PatternType" />
<xsd:element name="b" type="tns:PatternType" />
where tns
is a prefix for your schema target namespace
精彩评论