#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2002
    Location
    New York
    Posts
    6
    Rep Power
    0

    XSD Help needed with required and optional elements


    I need to create an xsd for the following element. The element has a number of parm elements. Some of the parms are required while others are optional. The 'colour' and 'age' parm elements are required. How can I describe the following using .xsd? Is it possible?


    Code:
    <car make="toyota" model="corolla">
      <!-- required parameters -->
      <parm name="colour">blue</parm>
      <parm name="age">4</parm>
      
      <!-- optional parameters -->
      <parm name="airConditioner">yes</parm>
      <parm name="airConditioner">yes</parm>
    </car>
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Location
    USA
    Posts
    334
    Rep Power
    11
    For required "parameters":

    <xs:attribute name="name" type="xs:string" fixed="colour" use="required"/>


    For optional "parameters":

    <xs:attribute name="name" type="xs:string" fixed="airConditioner" use="optional"/>

IMN logo majestic logo threadwatch logo seochat tools logo