473,387 Members | 3,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Restrictions on types

I have the following class hierarchy / type hierarchy:

A
a
b
c

The xml schema is something like this:

<complexType name="A">
<sequence>
<element minOccurs="1" name="parent" type="A"/>
</sequence>
</complexType>
<complexType name="a">
<complexContent>
<extension base="A"/>
</complexContent>
</complexType>
<complexType name="b">
<complexContent>
<extension base="A"/>
</complexContent>
</complexType>
<complexType name="c">
<complexContent>
<extension base="A"/>
</complexContent>
</complexType>
A is the superclass of a, b and c. A defines a parent that is a pointer
to an instance of one of its subclasses. But there are some
restrictions of what parent can be in the different subclasses. The
following rules apply:

a.parent can be instance of a
b.parent can be instance of a or b
c.parent can be instance of a or b

Is there a way I can capture this in XML Schema? Is there a way to use
enumeration on types?

Thanks
Kim
Aug 19 '05 #1
1 1238
Kim Lokøy writes:
I have the following class hierarchy / type hierarchy:

A
a
b
c

The xml schema is something like this:

<complexType name="A">
<sequence>
<element minOccurs="1" name="parent" type="A"/>
</sequence>
</complexType>
[Minor note -- this accepts only infinite documents -- minOccurs
maybe should be 0 ?]
<complexType name="a">
<complexContent>
<extension base="A"/>
</complexContent>
</complexType>
<complexType name="b">
<complexContent>
<extension base="A"/>
</complexContent>
</complexType>
<complexType name="c">
<complexContent>
<extension base="A"/>
</complexContent>
</complexType>
A is the superclass of a, b and c. A defines a parent that is a
pointer to an instance of one of its subclasses. But there are some
restrictions of what parent can be in the different subclasses. The
following rules apply:

a.parent can be instance of a
b.parent can be instance of a or b
c.parent can be instance of a or b

Is there a way I can capture this in XML Schema? Is there a way to
use enumeration on types?


I _think_ this would follow if you used restriction instead of
extension, but I can't be sure because I'm not clear what documents
you have in mind -- Is something such as

<root xsi:type='a'>
<parent xsi:type='b'>
<parent xsi:type='c'/>
</parent>
</root>

what you had in mind as OK, but

<root xsi:type='a'>
<parent xsi:type='b'>
<parent xsi:type='a'/>
</parent>
</root>

not OK?

ht
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
Aug 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Tom Dearst | last post by:
Gentlemen/Ladies, Is it common for a host to be so restrictive. http://ftphelp.secureserver.net/linux-phpinfo.html Linux http://ftphelp.secureserver.net/win-phpinfo.html Windows GoDaddy is the...
2
by: Victor | last post by:
I have a Schema with some elements which are "types" or objects, and some elements which correspond to instances of the types. How can I specify that a <locationInstance> must have an attribute...
2
by: Shailendra Batham | last post by:
Hello Gurus, I want to put some restrictions on my attribute tag in my XML Schema, anyone out there have any idea how to do that. here is my XML and the XML Schema <?xml version="1.0"...
2
by: matthew_glen_evans | last post by:
Hi there, Quick one about interfaces in c#. It seems that it is illegal to declare types within an interface. I was quite used to doing this in VB.net where the interface can define a...
1
by: Michael Dovel | last post by:
I am looking for what the server requirements and client restrictions will be for applications run from a web server using web forms. (I have not upgraded yet, am still using VB 6 Professional...
0
by: Junoti | last post by:
I've read several posts out there that state that setting typeFilterLevel="Full" on the client and/or server will correct this issue, however I'm still unable to get around it. I can successfully...
5
by: Dmitry Kulinich | last post by:
Guys! I've got 1 more small problem with XSD. It simple and good, but sometimes disappointing. For example we have 3 <THtags - only text and 1 attribute. Then we need...
1
by: Paul van Brouwershaven | last post by:
Hi All, I'm struggling with the WDSL restrictions in PHP/SOAP for a while know. I would like to create some simple restrictions in my WDSL file. The script are running both on the same server...
3
by: Marc Hebert | last post by:
I'm trying to figure out if something is possible to specify and constrain using a schema. I'll explain using an example. sample xml: <person name="John" age="32"/> <person name="Julie"...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.