XML Schema question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • calestar

    #1

    XML Schema question

    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:complexTy pe name="myElem">
    <xs:sequence>
    <xs:element name="title" type="xs:string " />
    </xs:sequence>
    </xs:complexType>
    <xs:complexTy pe name="myContain er">
    <xs:sequence>
    <xs:element name="myList" type="myElem" minOccurs="1" />
    </xs:sequence>
    </xs:complexType>
    <xs:complexTy pe name="myObj">
    <xs:sequence>
    <xs:element name="myContain erList" type="myContain er"
    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 <keyor
    <uniquedirectiv e, but it can be at 2-3 places.

    Any help is appreciated !

  • calestar

    #2
    Re: XML Schema question

    On 22 fév, 12:06, "calestar" <Cales...@gmail .comwrote:
    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:complexTy pe name="myElem">
    <xs:sequence>
    <xs:element name="title" type="xs:string " />
    </xs:sequence>
    </xs:complexType>
    <xs:complexTy pe name="myContain er">
    <xs:sequence>
    <xs:element name="myList" type="myElem" minOccurs="1" />
    </xs:sequence>
    </xs:complexType>
    <xs:complexTy pe name="myObj">
    <xs:sequence>
    <xs:element name="myContain erList" type="myContain er"
    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 <keyor
    <uniquedirectiv e, 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:complexTy pe name="myElem">
    <xs:attribute name="title" type="xs:string " />
    </xs:complexType>
    <xs:complexTy pe name="myContain er">
    <xs:sequence>
    <xs:element name="myList" type="myElem" minOccurs="1" />
    </xs:sequence>
    </xs:complexType>
    <xs:complexTy pe name="myObj">
    <xs:sequence>
    <xs:element name="myContain erList" type="myContain er" 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>

    Comment

    • usenet@tech-know-ware.com

      #3
      Re: XML Schema question

      On 22 Feb, 17:19, "calestar" <Cales...@gmail .comwrote:
      On 22 fév, 12:06, "calestar" <Cales...@gmail .comwrote:
      >
      >
      >
      >
      >
      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:complexTy pe name="myElem">
      <xs:sequence>
      <xs:element name="title" type="xs:string " />
      </xs:sequence>
      </xs:complexType>
      <xs:complexTy pe name="myContain er">
      <xs:sequence>
      <xs:element name="myList" type="myElem" minOccurs="1" />
      </xs:sequence>
      </xs:complexType>
      <xs:complexTy pe name="myObj">
      <xs:sequence>
      <xs:element name="myContain erList" type="myContain er"
      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 <keyor
      <uniquedirectiv e, 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:complexTy pe name="myElem">
      <xs:attribute name="title" type="xs:string " />
      </xs:complexType>
      <xs:complexTy pe name="myContain er">
      <xs:sequence>
      <xs:element name="myList" type="myElem" minOccurs="1" />
      </xs:sequence>
      </xs:complexType>
      <xs:complexTy pe name="myObj">
      <xs:sequence>
      <xs:element name="myContain erList" type="myContain er"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
      Codalogic LMX generates customized C++ code to read and write your XML data. Simplifies and speeds up code development and helps reduce bugs.

      Codalogic LMX generates customized C++ code to read and write your XML data. Simplifies and speeds up code development and helps reduce bugs.

      =============== =============== ===============

      Comment

      • calestar

        #4
        Re: XML Schema question

        On 23 fév, 04:41, use...@tech-know-ware.com wrote:
        On 22 Feb, 17:19, "calestar" <Cales...@gmail .comwrote:
        >
        >
        >
        >
        >
        On 22 fév, 12:06, "calestar" <Cales...@gmail .comwrote:
        >
        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:complexTy pe name="myElem">
        <xs:sequence>
        <xs:element name="title" type="xs:string " />
        </xs:sequence>
        </xs:complexType>
        <xs:complexTy pe name="myContain er">
        <xs:sequence>
        <xs:element name="myList" type="myElem" minOccurs="1" />
        </xs:sequence>
        </xs:complexType>
        <xs:complexTy pe name="myObj">
        <xs:sequence>
        <xs:element name="myContain erList" type="myContain er"
        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 <keyor
        <uniquedirectiv e, 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:complexTy pe name="myElem">
        <xs:attribute name="title" type="xs:string " />
        </xs:complexType>
        <xs:complexTy pe name="myContain er">
        <xs:sequence>
        <xs:element name="myList" type="myElem" minOccurs="1" />
        </xs:sequence>
        </xs:complexType>
        <xs:complexTy pe name="myObj">
        <xs:sequence>
        <xs:element name="myContain erList" type="myContain er" 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.c om/lmx
        =============== =============== ===============- Masquer letexte 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 !

        Comment

        Working...