Schema question

Discussion in 'XML' started by Robert Dailey, Jul 16, 2007.

  1. Take the following XML:


    <Frame type="Image" id="frame1">
    <Draw/>
    </Frame>

    <Frame type="Text" id="frame2">
    <Print/>
    </Frame>


    Is there a way in Schema to specify that the "Frame" element is
    different (and thus requires different child elements) depending on
    the value of an attribute (specifically the "type" attribute)?
     
    Robert Dailey, Jul 16, 2007
    #1
    1. Advertising

  2. Robert Dailey wrote:
    > Is there a way in Schema to specify that the "Frame" element is
    > different (and thus requires different child elements) depending on
    > the value of an attribute (specifically the "type" attribute)?


    Presence or absence, maybe. Value, I don't think so. Some of the other
    schema(-like) languages do support that, or you can enforce that
    constrating in the application code...


    --
    Joe Kesselman / Beware the fury of a patient man. -- John Dryden
     
    Joseph Kesselman, Jul 16, 2007
    #2
    1. Advertising

  3. On Jul 16, 1:05 pm, Joseph Kesselman <>
    wrote:
    > Robert Dailey wrote:
    > > Is there a way in Schema to specify that the "Frame" element is
    > > different (and thus requires different child elements) depending on
    > > the value of an attribute (specifically the "type" attribute)?

    >
    > Presence or absence, maybe. Value, I don't think so. Some of the other
    > schema(-like) languages do support that, or you can enforce that
    > constrating in the application code...
    >
    > --
    > Joe Kesselman / Beware the fury of a patient man. -- John Dryden


    Thank you for your reply, it was the answer I was looking for.

    I would also like to ask if it's possible to make a schema accept
    either of the following attribute combinations for a single element:

    <Offset x="0" y="0"/>
    <Offset var="myvar"/>

    Is this possible?
     
    Robert Dailey, Jul 16, 2007
    #3
  4. Robert Dailey

    Guest

    On 16 Jul, 20:36, Robert Dailey <> wrote:
    > On Jul 16, 1:05 pm, Joseph Kesselman <>
    > wrote:
    >
    > > Robert Dailey wrote:
    > > > Is there a way in Schema to specify that the "Frame" element is
    > > > different (and thus requires different child elements) depending on
    > > > the value of an attribute (specifically the "type" attribute)?

    >
    > > Presence or absence, maybe. Value, I don't think so. Some of the other
    > > schema(-like) languages do support that, or you can enforce that
    > > constrating in the application code...

    >
    > > --
    > > Joe Kesselman / Beware the fury of a patient man. -- John Dryden

    >
    > Thank you for your reply, it was the answer I was looking for.
    >
    > I would also like to ask if it's possible to make a schema accept
    > either of the following attribute combinations for a single element:
    >
    > <Offset x="0" y="0"/>
    > <Offset var="myvar"/>
    >
    > Is this possible?


    In schema you can effectively only specify the union of the two
    types. As a result things like <Offsett x="0" var="myvar"/> would
    also validate. You could apply additional constraints at the
    application level. XSD1.1 is due to improve onthis and Relax-NG
    supports what you want.

    HTH,

    Pete.
    --
    =============================================
    Pete Cordell
    Codalogic Ltd
    for XML Schema to C++ data binding visit
    http://www.codalogic.com/lmx/
    =============================================
     
    , Jul 18, 2007
    #4
    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. Markus
    Replies:
    1
    Views:
    1,580
    Markus
    Nov 23, 2005
  2. Klaus Johannes Rusch

    Re: Convert DB2 schema to XML Schema

    Klaus Johannes Rusch, Aug 6, 2003, in forum: XML
    Replies:
    0
    Views:
    557
    Klaus Johannes Rusch
    Aug 6, 2003
  3. Brett Selleck

    Schema Metadata not a Metadata Schema

    Brett Selleck, Sep 4, 2003, in forum: XML
    Replies:
    1
    Views:
    418
    Andy Dingley
    Sep 4, 2003
  4. Fred Smith
    Replies:
    1
    Views:
    954
    Martin Honnen
    Feb 5, 2004
  5. Stanimir Stamenkov
    Replies:
    3
    Views:
    1,275
    Stanimir Stamenkov
    Apr 25, 2005
Loading...

Share This Page