simple xsd question...

Discussion in 'XML' started by, Mar 13, 2007.

  1. Guest

    I am new to making schema for xml and am not exactly sure on a certain
    restriction i need to make within an xsd. Take for example, a
    complexType Car. I am trying to restrict certain elements from being
    used when others are present. When I have an element leatherType
    within Car, I do not want to allow the element fabricType to be used
    in the same Car anymore.

    If my explanation is a little confusion, here is the xml sructured I
    want to restrict from happening:
    <Car name=mine>

    (note: these are not the only two elements allowed for Car, many other
    different elements may occur in there also but I only want to restrict
    fabric because leather is there.)

    Thanks for the help guys!
    , Mar 13, 2007
    1. Advertisements

  2. Guest

    After thinking about this for a little while, I figured I should
    explain what this solution is really going to be used for. The xml
    elements I am trying to restrict are 3 against 1. For example, if one
    certain element is a child of the Car "mine" , there are three other
    elements that cannot be.

    At first I thought that choice could be made between each element and
    the restrictive one. But then, what if I have three choices for that
    same restrictive element?

    Is there some way a choice could be made between groups?
    , Mar 13, 2007
    1. Advertisements

  3. wrote:
    > Is there some way a choice could be made between groups?

    I believe the simplest answer is to make the choice between one element
    and another which contains one or more of the group you're trying to
    restrict. Or to make the choice at a higher level, so you have different
    content models for the two groups.

    Or, impose the restriction in the application rather than in the schema.
    Schemas aren't intended to handle every possible content interaction,
    and should be considered a first-cut description of a meaningful
    document, NOT necessarily a complete guarantee thereof.

    Joe Kesselman / Beware the fury of a patient man. -- John Dryden
    Joseph Kesselman, Mar 13, 2007
    1. Advertisements

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. Markus
    Nov 22, 2005
  2. Rick Razzano

    XSD document for XSD defintion

    Rick Razzano, Sep 26, 2003, in forum: XML
    C. M. Sperberg-McQueen
    Sep 26, 2003
  3. Replies:
    Martin Honnen
    Jan 14, 2004
  4. Peter Aberline

    xsd:any as a child of xsd:all

    Peter Aberline, Apr 5, 2004, in forum: XML
    Peter Aberline
    Apr 5, 2004
  5. Bernd Oninger
    Henry S. Thompson
    Jun 30, 2004

Share This Page