XML Schema question

Discussion in 'XML' started by calestar, Feb 22, 2007.

  1. calestar

    calestar Guest

    Hi !
    I'm kinda beginning with XML and I've got this fairly complex schema
    (±108 KB on 9 files ... ). I need to do some restriction in it.

    The structure is something like :

    --------------------------------------------------------------------
    <xs:complexType name="myElem">
    <xs:sequence>
    <xs:element name="title" type="xs:string" />
    </xs:sequence>
    </xs:complexType>
    <xs:complexType name="myContainer">
    <xs:sequence>
    <xs:element name="myList" type="myElem" minOccurs="1" />
    </xs:sequence>
    </xs:complexType>
    <xs:complexType name="myObj">
    <xs:sequence>
    <xs:element name="myContainerList" type="myContainer"
    minOccurs="1" />
    </xs:sequence>
    </xs:complexType>
    <xs:element name="myBase">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="myObjList" type="myObj" minOccurs="1" />
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    --------------------------------------------------------------------


    Now, what I need to do is to make sure that a "myElem" element with
    a specific title is present somewhere, in at least one container in
    any object from the list.

    I know I can make it appear at only one place with the <key> or
    <unique> directive, but it can be at 2-3 places.

    Any help is appreciated !
    calestar, Feb 22, 2007
    #1
    1. Advertising

  2. calestar

    calestar Guest

    On 22 fév, 12:06, "calestar" <> wrote:
    > Hi !
    > I'm kinda beginning with XML and I've got this fairly complex schema
    > (±108 KB on 9 files ... ). I need to do some restriction in it.
    >
    > The structure is something like :
    >
    > --------------------------------------------------------------------
    > <xs:complexType name="myElem">
    > <xs:sequence>
    > <xs:element name="title" type="xs:string" />
    > </xs:sequence>
    > </xs:complexType>
    > <xs:complexType name="myContainer">
    > <xs:sequence>
    > <xs:element name="myList" type="myElem" minOccurs="1" />
    > </xs:sequence>
    > </xs:complexType>
    > <xs:complexType name="myObj">
    > <xs:sequence>
    > <xs:element name="myContainerList" type="myContainer"
    > minOccurs="1" />
    > </xs:sequence>
    > </xs:complexType>
    > <xs:element name="myBase">
    > <xs:complexType>
    > <xs:sequence>
    > <xs:element name="myObjList" type="myObj" minOccurs="1" />
    > </xs:sequence>
    > </xs:complexType>
    > </xs:element>
    > --------------------------------------------------------------------
    >
    > Now, what I need to do is to make sure that a "myElem" element with
    > a specific title is present somewhere, in at least one container in
    > any object from the list.
    >
    > I know I can make it appear at only one place with the <key> or
    > <unique> directive, but it can be at 2-3 places.
    >
    > Any help is appreciated !


    **************** Edit
    Sorry ... a little mistake in the XML Schema : title is an Attribute
    of myElem, not an element ...

    <xs:complexType name="myElem">
    <xs:attribute name="title" type="xs:string" />
    </xs:complexType>
    <xs:complexType name="myContainer">
    <xs:sequence>
    <xs:element name="myList" type="myElem" minOccurs="1" />
    </xs:sequence>
    </xs:complexType>
    <xs:complexType name="myObj">
    <xs:sequence>
    <xs:element name="myContainerList" type="myContainer" minOccurs="1" /
    >

    </xs:sequence>
    </xs:complexType>
    <xs:element name="myBase">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="myObjList" type="myObj" minOccurs="1" />
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    calestar, Feb 22, 2007
    #2
    1. Advertising

  3. calestar

    Guest

    On 22 Feb, 17:19, "calestar" <> wrote:
    > On 22 fév, 12:06, "calestar" <> wrote:
    >
    >
    >
    >
    >
    > > Hi !
    > > I'm kinda beginning with XML and I've got this fairly complex schema
    > > (±108 KB on 9 files ... ). I need to do some restriction in it.

    >
    > > The structure is something like :

    >
    > > --------------------------------------------------------------------
    > > <xs:complexType name="myElem">
    > > <xs:sequence>
    > > <xs:element name="title" type="xs:string" />
    > > </xs:sequence>
    > > </xs:complexType>
    > > <xs:complexType name="myContainer">
    > > <xs:sequence>
    > > <xs:element name="myList" type="myElem" minOccurs="1" />
    > > </xs:sequence>
    > > </xs:complexType>
    > > <xs:complexType name="myObj">
    > > <xs:sequence>
    > > <xs:element name="myContainerList" type="myContainer"
    > > minOccurs="1" />
    > > </xs:sequence>
    > > </xs:complexType>
    > > <xs:element name="myBase">
    > > <xs:complexType>
    > > <xs:sequence>
    > > <xs:element name="myObjList" type="myObj" minOccurs="1" />
    > > </xs:sequence>
    > > </xs:complexType>
    > > </xs:element>
    > > --------------------------------------------------------------------

    >
    > > Now, what I need to do is to make sure that a "myElem" element with
    > > a specific title is present somewhere, in at least one container in
    > > any object from the list.

    >
    > > I know I can make it appear at only one place with the <key> or
    > > <unique> directive, but it can be at 2-3 places.

    >
    > > Any help is appreciated !

    >
    > **************** Edit
    > Sorry ... a little mistake in the XML Schema : title is an Attribute
    > of myElem, not an element ...
    >
    > <xs:complexType name="myElem">
    > <xs:attribute name="title" type="xs:string" />
    > </xs:complexType>
    > <xs:complexType name="myContainer">
    > <xs:sequence>
    > <xs:element name="myList" type="myElem" minOccurs="1" />
    > </xs:sequence>
    > </xs:complexType>
    > <xs:complexType name="myObj">
    > <xs:sequence>
    > <xs:element name="myContainerList" type="myContainer" minOccurs="1" /
    >
    > </xs:sequence>
    > </xs:complexType>
    > <xs:element name="myBase">
    > <xs:complexType>
    > <xs:sequence>
    > <xs:element name="myObjList" type="myObj" minOccurs="1" />
    > </xs:sequence>
    > </xs:complexType>
    > </xs:element>- Hide quoted text -
    >
    > - Show quoted text -


    I'm not exactly sure what you want, but if your XML instances are
    allowed multiple occurences of elements with a title attribute, and
    you want one of them to have specific text, while the others are
    allowed other text, then I don't think you can do that in XML Schema
    at present.

    Pete.
    --
    =============================================
    Pete Cordell
    Tech-Know-Ware Ltd
    for XML to C++ data binding visit
    http://www.tech-know-ware.com/lmx
    http://www.codalogic.com/lmx
    =============================================
    , Feb 23, 2007
    #3
  4. calestar

    calestar Guest

    On 23 fév, 04:41, wrote:
    > On 22 Feb, 17:19, "calestar" <> wrote:
    >
    >
    >
    >
    >
    > > On 22 fév, 12:06, "calestar" <> wrote:

    >
    > > > Hi !
    > > > I'm kinda beginning with XML and I've got this fairly complex schema
    > > > (±108 KB on 9 files ... ). I need to do some restriction in it.

    >
    > > > The structure is something like :

    >
    > > > --------------------------------------------------------------------
    > > > <xs:complexType name="myElem">
    > > > <xs:sequence>
    > > > <xs:element name="title" type="xs:string" />
    > > > </xs:sequence>
    > > > </xs:complexType>
    > > > <xs:complexType name="myContainer">
    > > > <xs:sequence>
    > > > <xs:element name="myList" type="myElem" minOccurs="1" />
    > > > </xs:sequence>
    > > > </xs:complexType>
    > > > <xs:complexType name="myObj">
    > > > <xs:sequence>
    > > > <xs:element name="myContainerList" type="myContainer"
    > > > minOccurs="1" />
    > > > </xs:sequence>
    > > > </xs:complexType>
    > > > <xs:element name="myBase">
    > > > <xs:complexType>
    > > > <xs:sequence>
    > > > <xs:element name="myObjList" type="myObj" minOccurs="1" />
    > > > </xs:sequence>
    > > > </xs:complexType>
    > > > </xs:element>
    > > > --------------------------------------------------------------------

    >
    > > > Now, what I need to do is to make sure that a "myElem" element with
    > > > a specific title is present somewhere, in at least one container in
    > > > any object from the list.

    >
    > > > I know I can make it appear at only one place with the <key> or
    > > > <unique> directive, but it can be at 2-3 places.

    >
    > > > Any help is appreciated !

    >
    > > **************** Edit
    > > Sorry ... a little mistake in the XML Schema : title is an Attribute
    > > of myElem, not an element ...

    >
    > > <xs:complexType name="myElem">
    > > <xs:attribute name="title" type="xs:string" />
    > > </xs:complexType>
    > > <xs:complexType name="myContainer">
    > > <xs:sequence>
    > > <xs:element name="myList" type="myElem" minOccurs="1" />
    > > </xs:sequence>
    > > </xs:complexType>
    > > <xs:complexType name="myObj">
    > > <xs:sequence>
    > > <xs:element name="myContainerList" type="myContainer" minOccurs="1" /

    >
    > > </xs:sequence>
    > > </xs:complexType>
    > > <xs:element name="myBase">
    > > <xs:complexType>
    > > <xs:sequence>
    > > <xs:element name="myObjList" type="myObj" minOccurs="1" />
    > > </xs:sequence>
    > > </xs:complexType>
    > > </xs:element>- Hide quoted text -

    >
    > > - Show quoted text -

    >
    > I'm not exactly sure what you want, but if your XML instances are
    > allowed multiple occurences of elements with a title attribute, and
    > you want one of them to have specific text, while the others are
    > allowed other text, then I don't think you can do that in XML Schema
    > at present.
    >
    > Pete.
    > --
    > =============================================
    > Pete Cordell
    > Tech-Know-Ware Ltd
    > for XML to C++ data binding visithttp://www.tech-know-ware.com/lmxhttp://www.codalogic.com/lmx
    > =============================================- Masquer le texte des messages précédents -
    >
    > - Afficher le texte des messages précédents -


    Thks for the answer ... I'm gonna look into doing something else to
    validate then !
    calestar, Feb 23, 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,522
    Markus
    Nov 23, 2005
  2. Fred Smith
    Replies:
    1
    Views:
    939
    Martin Honnen
    Feb 5, 2004
  3. Hari Om
    Replies:
    1
    Views:
    461
    Martin SChukrazy
    Mar 2, 2004
  4. Stanimir Stamenkov
    Replies:
    3
    Views:
    1,245
    Stanimir Stamenkov
    Apr 25, 2005
  5. Replies:
    3
    Views:
    2,830
Loading...

Share This Page