Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XML Schema question

Reply
Thread Tools

XML Schema question

 
 
calestar
Guest
Posts: n/a
 
      02-22-2007
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 !

 
Reply With Quote
 
 
 
 
calestar
Guest
Posts: n/a
 
      02-22-2007
On 22 fév, 12:06, "calestar" <(E-Mail Removed)> 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>

 
Reply With Quote
 
 
 
 
usenet@tech-know-ware.com
Guest
Posts: n/a
 
      02-23-2007
On 22 Feb, 17:19, "calestar" <(E-Mail Removed)> wrote:
> On 22 fév, 12:06, "calestar" <(E-Mail Removed)> 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
=============================================

 
Reply With Quote
 
calestar
Guest
Posts: n/a
 
      02-23-2007
On 23 fév, 04:41, (E-Mail Removed) wrote:
> On 22 Feb, 17:19, "calestar" <(E-Mail Removed)> wrote:
>
>
>
>
>
> > On 22 fév, 12:06, "calestar" <(E-Mail Removed)> 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 !

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
web.xml / XML schema issue, why do some XML schema attributes disappear asciz@starmail.com Java 3 02-20-2007 09:56 AM
Validation with XSD using XML::LibXML::Schema, and XML::Validator::Schema huntingseasonson@gmail.com Perl Misc 5 11-29-2006 12:37 PM
[XML Schema] Including a schema document with absent target namespace to a schema with specified target namespace Stanimir Stamenkov XML 3 04-25-2005 09:59 AM
XML Schema to XML Schema Conversion Hari Om XML 1 03-02-2004 09:04 PM
XML schema regular expressions question and recommended XML Schema book Fred Smith XML 1 02-05-2004 11:12 AM



Advertisments