Complex attribute with Attribute and simpletype

Discussion in 'XML' started by kanpeter, Oct 26, 2010.

  1. kanpeter

    kanpeter Guest

    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>
    kanpeter, Oct 26, 2010
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    435
  2. sk
    Replies:
    1
    Views:
    418
    Priscilla Walmsley
    Jun 14, 2006
  3. JamesG
    Replies:
    0
    Views:
    350
    JamesG
    Apr 19, 2007
  4. JamesG
    Replies:
    2
    Views:
    384
    JamesG
    Apr 21, 2007
  5. Anil Mamede
    Replies:
    2
    Views:
    419
    Anil Mamede
    Apr 6, 2008
Loading...

Share This Page