XML Schema question

C

calestar

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 !
 
C

calestar

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:complexType>
<xs:element name="myBase">
<xs:complexType>
<xs:sequence>
<xs:element name="myObjList" type="myObj" minOccurs="1" />
</xs:sequence>
</xs:complexType>
</xs:element>
 
U

usenet

**************** 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
=============================================
 
C

calestar

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 !
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,782
Latest member
ThomasGex

Latest Threads

Top