Complex attribute with Attribute and simpletype

K

kanpeter

Is it possible to combine the following into a single element (i.e.
SimpleType "FromTo" will be declared inside element "Frequency" and no
need to reference outside) ?

<xs:simpleType name="FromTo">
<xs:restriction base="xs:string">
<xs:pattern value="[0-9]?[0-9]?[0-9]|[0-9]?[0-9]?[0-9]-[0-9]?[0-9]?
[0-9]"/>
</xs:restriction>
</xs:simpleType>

<xs:element name="Frequency">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="FromTo">
<xs:attribute name="unit" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Min."/>
<xs:enumeration value="Hr."/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top