Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > simple xsd question...

Reply
Thread Tools

simple xsd question...

 
 
foolproofplan@gmail.com
Guest
Posts: n/a
 
      03-13-2007
I am new to making schema for xml and am not exactly sure on a certain
restriction i need to make within an xsd. Take for example, a
complexType Car. I am trying to restrict certain elements from being
used when others are present. When I have an element leatherType
within Car, I do not want to allow the element fabricType to be used
in the same Car anymore.

If my explanation is a little confusion, here is the xml sructured I
want to restrict from happening:
<Car name=mine>
<leatherType>nice<leatherType/>
<fabricType>okay<fabricType/>
</Car>

(note: these are not the only two elements allowed for Car, many other
different elements may occur in there also but I only want to restrict
fabric because leather is there.)

Thanks for the help guys!

 
Reply With Quote
 
 
 
 
foolproofplan@gmail.com
Guest
Posts: n/a
 
      03-13-2007
After thinking about this for a little while, I figured I should
explain what this solution is really going to be used for. The xml
elements I am trying to restrict are 3 against 1. For example, if one
certain element is a child of the Car "mine" , there are three other
elements that cannot be.

At first I thought that choice could be made between each element and
the restrictive one. But then, what if I have three choices for that
same restrictive element?

Is there some way a choice could be made between groups?

 
Reply With Quote
 
 
 
 
Joseph Kesselman
Guest
Posts: n/a
 
      03-13-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Is there some way a choice could be made between groups?


I believe the simplest answer is to make the choice between one element
and another which contains one or more of the group you're trying to
restrict. Or to make the choice at a higher level, so you have different
content models for the two groups.

Or, impose the restriction in the application rather than in the schema.
Schemas aren't intended to handle every possible content interaction,
and should be considered a first-cut description of a meaningful
document, NOT necessarily a complete guarantee thereof.


--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
 
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
XML + XSD: Is it possible to get all errors against the XSD? Markus Java 1 11-22-2005 02:53 PM
Difference between <import ....xsd> and <xlink:href=.....xsd> ???? Bernd Oninger XML 1 06-30-2004 08:21 AM
xsd:any as a child of xsd:all Peter Aberline XML 0 04-05-2004 03:38 PM
referencing another XSD file within an XSD file JavaDeveloper@nowhere.com XML 1 01-14-2004 05:22 PM
XSD document for XSD defintion Rick Razzano XML 1 09-26-2003 12:41 AM



Advertisments