Restriction on attributes in XSD

Discussion in 'XML' started by vincente13@gmail.com, Jun 12, 2006.

  1. Guest

    Hi all,

    I would like to know if this schema is correct..

    .....
    .....
    <xs:simpleType name="stringtype">
    <xs:restriction base="xs:string"/>
    </xs:simpleType>

    ....
    ....
    ...
    <xs:element name="opsmenu">
    ....
    .....
    ....
    <xs:attribute name="debug" use="optional">
    <xs:simpleType>
    <xs:restriction base="stringtype">
    <xs:pattern value="on|off"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:attribute>
    .....
    .....

    <opsmenu debug="on"> -->> this is my root element in the xml

    debug attribute is either on or off and it is optional...

    Is the above declarations correct?
    I'm getting this error Found <simpleType> illegally combined with
    <complexType>.

    Im not sure if the declaration is right or there is a bug in the
    parser.

    Appreciate any inputs
     
    , Jun 12, 2006
    #1
    1. Advertising

  2. Hi,

    The code you've posted here looks fine. However, it might be something
    in the parts you left out. If you post the whole section of the schema
    (at least the entire declaration of opsmenu) we can probably help you
    out better.

    Priscilla

    ----------------------------------
    Priscilla Walmsley
    Author, Definitive XML Schema
    XQuery
    http://www.datypic.com
    ----------------------------------

    *** Sent via Developersdex http://www.developersdex.com ***
     
    Priscilla Walmsley, Jun 14, 2006
    #2
    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. Ed Slen

    xsd restriction

    Ed Slen, Jun 25, 2003, in forum: XML
    Replies:
    1
    Views:
    1,935
    Derek Harmon
    Jun 25, 2003
  2. Cat
    Replies:
    3
    Views:
    2,696
    Henry S. Thompson
    Jun 25, 2004
  3. Lars Geldner

    [XSD] derivation by restriction

    Lars Geldner, Dec 27, 2004, in forum: XML
    Replies:
    4
    Views:
    629
    Henry S. Thompson
    Jan 7, 2005
  4. SP

    XSD restriction

    SP, Sep 26, 2005, in forum: XML
    Replies:
    0
    Views:
    469
  5. Replies:
    7
    Views:
    723
Loading...

Share This Page