I wrote a XML type definition, but it is not correct. Where my mistake? How can I rewrite it?
<xs:complexType name="resourceKeyName">
<xs:simpleContent>
<xs:restriction base="xs:string">
<xs:maxLength value="30"/>
<xs:minLength value="5"/>
<xs:pattern value="^ref-"/>
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
===================================
update
I rewrote my code like this:
<xs:complexType name="_inner">
<xs:simpleContent>
<xs:extension base="xs:string">
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="resourceKeyName">
<xs:simpleContent>
<xs:restriction base="_inner">
<xs:maxLength value="30"/>
<xs:minLength value="5"/>
<xs:pattern value="^ref-"/>
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
The code is correct now, but I don’t like such a solution.
Why not:
Do you want to have type which has nested elements, or just text content? If you want text – you should create
xs:simpleType.